Wednesday, May 10, 2017

நாட்டுப்பற்றுக்கு ஒரு சோதனை


நாட்டுப்பற்றுக்கு ஒரு சோதனை


வணக்கம். நான் ஒரு கணினி பொறியாளன். உங்கள மாதிரியே நாட்டுப்பற்றுள்ளவன்.  இதுல ஒரு விஷயம் பாருங்க, இந்த நாட்டுப்பற்றை எப்படி வெளிப்படுத்தறதுன்னு பல பேருக்கு தெரியறதில்லை.

நானும் யோசிச்சேன்.

வருஷத்துக்கு ஒரு முறை schoolலயோ, collegeலயோ, officeலயோ, தேசிய கோடி ஏத்தி கீதம் பாடினா ஆச்சா? இல்லை ஒவ்வொரு நாளும் ஒவ்வொரு நொடியும் அந்த உணர்வு நமக்குள் இருக்கணுமா?

நிச்சயமா இருக்கணும். இல்லியா?

சரி. அப்படின்னா மொதல்ல நாட்டுபற்றுன்னா என்னன்னு சின்னதா define பண்ணுவோம்.

நாட்டை பற்றிய ஒரு அக்கறை. நம் நாட்டு மக்களின் மீதுள்ள ஒரு அக்கறை. இந்த நாட்டின் சட்ட திட்டங்களை மதித்து நடத்தல் ஆகியன. இது மட்டும் இருந்தாலே போதும். அதாவதுங்க, நம்மை விட, நம்மை சார்ந்திருப்பவர்களின் நலனை நாம் உணரும்போது, நினைக்கும்போது, நாம் நாட்டுப்பற்று உள்ளவர்கள் ஆகிறோம்.

ஆனா, இது மனசளவுல இருந்தா மட்டும் போதாது. செயல்ல எப்படி காட்டுறது?

கஷ்டம் இல்லை... மிக சுலபம். உதாரணத்துக்கு, சாதாரண traffic signalஐ எடுத்துப்போம். நாம் என்ன செய்யறோம். முதலில், STOP LINE அப்படின்னு ஒண்ணு இருக்கு. அதை மீறி தான் வண்டியவே நிறுத்தறோம். [Stop line ஆ... சென்னைல அப்படின்னு ஒண்ணு இருக்கான்னு சொல்ற உங்க மைன்ட் வாய்ஸ் கேக்குது. அந்த discussion அப்புறமா வச்சிப்போம்]. அப்புறம், மற்றவங்களுக்கு signal கிரீன்ல இருக்கும்போதே கொஞ்சம் கொஞ்சமா முன்னாடி [சுத்த சென்னை தமிழ்ல சொல்லனும்னா பீறாஞ்சுக்குனே] போயி, பாதி ரோட்டுல நிப்பாட்டுவோம். எதிருல வர்றவனுக்கு green போயி yellow தான் வந்திருக்கும். அப்பவே உறுமி உறுமி, நமக்கு green வந்தவுடனே அவனை block பண்ணி, அவனை திட்டிகிட்டே அவசர அவசரமா போயி... ... ... அடுத்த சிக்னல்ல நிப்போம்.

நமக்கு இருக்குற அதே சுதந்திரம், உரிமை, மற்றவங்களுக்கும் இருக்குங்கறத மறக்கறோம், மறுக்குறோம்.

நம்மை திருத்த ஒரு போலீஸ்காரன் எதற்கு. போலிஸ பாத்தா சிக்னல்ல நிறுத்துவோம். இல்லைன்னா...

இதில என்ன ஒரு இழுக்குன்னா, உலகத்துக்கே கலாச்சாரம் என்றால் என்ன என்று சொல்லிக்கொடுத்த தேசம் நமது. இந்த உண்மையை மறந்துவிட்டோம்... அல்லது மறக்கடிக்கப்பட்டோம்.

சித்தர்களும், ஞானிகளும் வாழ்ந்து, மறைந்து வாழ்ந்து கொண்டிருக்கும் பூமி இது.

இந்த நாட்டின் சட்ட திட்டங்களை மதித்து நடக்க நாம் கர்வம் கொள்ள வேண்டும். காந்தி முன்னே சொன்ன ஒரு வசனம் இப்பொழுது ஞாபகம் வருகிறது. Be the change that you wish to see in the world.

கலாச்சாரத்தின் சிகரமாய் இருந்த நாம் மீண்டும் அந்நிலைக்கு வர, நாம் எடுத்து வைக்கும் முதல் அடி.

நாளை என்றொரு நாள் வரவே வராதென்றார் இன்னொரு ஞானி. அதனால், செய்வதை இன்றே, இப்பொழுதே செய்வோம்.

ஆதலால், இன்று முதல், சாலையில் எங்கு சிக்னல் இருந்தாலும், அதை மதித்து நடப்போம். அது இரவு பன்னிரண்டு மணியானாலும் பரவாயில்லை, ரெண்டு மணியானாலும் பரவாயில்லை. அங்கு போலீஸ் இருந்தாலும் சரி இல்லா விட்டாலும் சரி. இன்று முதல் சாலை விதிகளை மதிப்போம். நம் நாட்டுப்பற்றை அக்கறையால் வெளிக்கொணர்வோம்

இது தான் நாம் எடுத்து வைக்கும் முதல் அடி.

Saturday, May 06, 2017

How can Cloudflare protect your server?



Cloudflare to safeguard your server


This message is not an endorsement of Cloudflare and its services. 

This is just a reflection on how we have been using Cloudflare for dns and basic site protection for many of our sites.

For those who do not know, Cloudflare is one of the best available CDN services. CDN stands for Content Delivery Network, which is a man in the middle software application which delivers your website content to your customers, while at the same time protecting your server from people and sites with malicious intentions.

Cloudflare FREE basic protection

The Cloudflare basic protection is free and is good enough for most sites, but if you are a site with a lot of hits and need better protection, you may opt for their business or enterprise plan though.

Some of you may have the question of "How do I setup Cloudflare for my webserver/website?" Here is an indication of what you need to do to put your site up on cloudflare.com.

  • Get yourself a Cloudflare account
  • Add your domain name to cloudflare
    • Add your domain name to your newly created Cloudflare account
  • Cloudflare will give you a set of dns names
    • These names will be given to you by Cloudflare
  • Logon to your domain seller site and change the existing DNS names to what Cloudflare gave you
    • Change your name servers to point to the DNS servers of Cloudflare.com
  • Change the security settings to protect your server from most attacks
    • Activate the Cloudflare CDN to create a transparent SSL protected for your website

The Basic and Free version of Cloudflare can protect websites from simple attacks. Cloudflare is also reconfigured with standard captcha to protect your website. For sites that require better protection, there is the Enterprise version of Cloudflare.

You might want to give it a try!

Friday, May 05, 2017

Is the world a fair place?

Is the world a fair place?

May be you wished to ask "is nature cruel?"

An honest and experienced opinion would be "Nature is Just". And nature at all times, gives us only what we deserve. 

Nature gives us experience every moment of our lives, in order for us to learn from it and elevate ourselves in our quest for the truth.

What is required of us is to accept the fact that nature is always working towards our betterment. The experience and understanding of life would be different for each of us, depending on how advanced our souls are. Those near the top end of the pyramid would probably be able to see the truth in the short anecdote that follows.

Left side mirror in automobile needs to be replaced. Customer gets a call from dealer. Customer is upset and angry when representative told the painting work will be done only after customer visits the dealer.

After sometime, the dealership called and said the spare part would be sent across to the customer's address. But, when the spare part came, it did not fit. It was for a different model.

On introspection, the turning point was the angry reaction by the customer.

If the customer had said, "Okay. Will come tomorrow?" and went to the dealership, the dealer would have probably have had a look at the vehicle and could have identified the correct spare part, saving time.

Lesson learnt: Do not react to stimuli. Be still!!!

Wednesday, May 03, 2017

NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP) Cannot communicate securely with peer: no common encryption algorithm(s)


NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP) Cannot communicate securely with peer: no common encryption algorithm(s). * Closing connection 0

I encountered a link which told me to update nss to fix the issue, like so.

If you're on CentOS 7 and are getting these errors while using yum, updating nss nss-util nss-sysinit nss-tools will fix it.

But, then, it did not seem to solve my problem, while setting the "setopt" option in curl for SSLVERSION seemed to fix it, magically.

See below:

The problem was sorted out when the following options were set in the curl_setopt() before calling curl

curl_setopt($ch, CURLOPT_SSLVERSION, 6);

Problem SOLVED

Saturday, April 08, 2017

SOLVED: sftp Error: Connection timed out after 20 seconds of inactivity

Error: Connection timed out after 20 seconds of inactivity


I just want to share a peculiar sftp connectivity issue that we encountered recently.

This is the message we got when trying to connect to the server using sftp

Status: Connecting to mydomain.com...
Response: fzSftp started, protocol_version=8
Command: keyfile "somefile.ppk"
Command: open "user@mydomain.com" 22
Error: Connection timed out after 20 seconds of inactivity
Error: Could not connect to server

We usually connect to my remote server using sftp to upload and download the work files.

All was well till yesterday, when suddenly, the connectivity to the server was not happening.

We distinctly remember being able to connect till sometime back, before the above error cropped up suddenly.

We were breaking our heads as to why the connection was not happening.

Rolled back in time and evaluated the things that we did during the past hours. It was suddenly that we got a brainwave that solved the problem.

The explanation:

It occurred to us that we had just enabled the CDN for the server. You know what the CDN does. It obfuscates the real IP address of the domain and replaces it with a different IP address.

So, the sftp was trying to connect to one of the CDN's IP addresses, which resulted in the "Connection timed out after 20 seconds of inactivity".

To put it simply, what was happening was that the request to mydomain.com was resolving to the IP address of the CDN.

The solution:

So, we then created a sub-domain and kept it outside the CDN and used that name instead of the domain name.

Alternately, you can also use the real ip address of your domain.

Simple, but till you get the hang of it, it is a real blood boiler.

That, in short is how we solved the "Connection timed out after 20 seconds of inactivity" problem.

Saturday, April 01, 2017

Maximum allowed value for a string variable content in JavaScript

What is the maximum string content that can fit inside a Javascript variable?

I had this requirement where my Ajax script would return a sizeable amount of data for processing.

It was at this moment that I wondered if the returned value would fit inside a variable. I browsed through some of the available feedback in a Google search.

Most of them opined that there is no limit on the string variable content.

How do we check the maximum value for a string variable?

So, I thought, "let us check it in real time".

As per my test, I found out that a large string with a length of 102400 was initialized without generating any JavaScript error.

I am sure, nobody would require anything more than this inside their JavaScript variable.

Here is my statement:
I tested by initializing a JavaScript variable, in the browser console, with over 100,000 characters without an error.

My test machine was an I7 with 4GB of RAM.

Saturday, March 11, 2017

What is Spirituality?

Essentially, spirituality is the individual's search to understand the Universal truth.


So, what is the Universal truth?


It is a fact that we are all in this world, to play endless games (re-births! Are they for real? We will discuss this later), to make us ready for the next stage in our evolution.

Over the course of time, we will try to find logical and rational reasons for the meaning of life on Earth.

Spirituality is a subject that we learn, like any other.

And like any subject, the students of spirituality rank from being in the kindergarten to the ones who have achieved the doctorate level.

One tends to understand inherently the ways and means of the cosmic system and consciousness over a period of time.

One trait I have seen in spiritual people is compassion for self and other fellow beings, humans, animals and others; a universal love which encompasses all the living and non living beings.

A spiritual being does not want to disturb nature. He/she enjoys being one with nature; blend in and feel the bliss.

A spiritual being likes to lead the straight path, which is the path towards realising the universal truth.

A spiritual being knows and understands that there are different roads that lead to the destination. He/she is not restricted but open to external thoughts and validations to reinforce their belief.

We have heard, accept and understand that "All roads lead to Rome".

It is believed that we have been using this metaphor since the 12th century, due to the well known fact that the well designed road network of the Roman Empire, spread out like wheel spokes.

A spiritual being need not be religiously inclined though. Because, he/she knows that religion is also one of the paths that lead to the goal.

As we reach farther in the path towards realisation, we find out that all the paths converge and lead to the same goal. When we look back, we find that there are people who follow the different paths, at the start of the journey; this includes those of the non-believers, who fight amongst themselves to establish their path as the only true one.

The methods may be different, but the result is the same.

Wednesday, March 08, 2017

Solved "XAMPP: Couldn't start MySQL!"


The error XAMPP: Couldn't start MySQL! seems to be an issue related to one or more corrupt log files; system running Red Hat. It was sorted out by the following steps.

Corrupt log file in MySQL


A review of the error log revealed the following 

170308 19:44:18 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/ip-192-168-2-1.pid ended
170308 19:48:20 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
170308 19:48:20 [Note] Plugin 'FEDERATED' is disabled.
170308 19:48:20 InnoDB: The InnoDB memory heap is disabled
170308 19:48:20 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
170308 19:48:20 InnoDB: Compressed tables use zlib 1.2.3
170308 19:48:20 InnoDB: Initializing buffer pool, size = 512.0M
170308 19:48:20 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file /opt/lampp/var/mysql/ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 134217728 bytes!
170308 19:48:20 [ERROR] Plugin 'InnoDB' init function returned error.
170308 19:48:20 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170308 19:48:20 [ERROR] Unknown/unsupported storage engine: InnoDB
170308 19:48:20 [ERROR] Aborting

Remove the corrupt log files


Since, the log file is corrupt, we will be removing the log file and try and start the session.

sudo rm /opt/lampp/var/mysql/ib_logfile0
sudo rm /opt/lampp/var/mysql/ib_logfile1

Then, start/restart lampp using 

/opt/lampp/lampp start
[or]
/opt/lampp/lampp restart


MySQL started again!

Monday, February 27, 2017

Debugging jQuery Code for dummies

At least some of us might have learnt jQuery the hard way.

As it has been said for a long time, the best way to understand jquery or any other code is to read through code written by other people. jQuery is unique because it uses html and css flags to make things happen.

Debugging jQuery code is sometimes not easy, even with some experience. This is because, parts of html and JavaScript code are linked together by a id or a class.

Steps to debug jQuery


I will try and explain the steps by way of a html and jQuery code example below.

Find the trigger word


You see, buttons or links are created with id or class and the id and class names are then used to trigger activity.

In one part of the code, there will be something like




There are events that trigger an action. The event may be on an input field, a list box a submit button or something else; and the event may be a change in the field, a click on a field, a mouse over action, a mouse out action and other such events.


Locate the trigger word in the JavaScript/jQuery code


Elsewhere in the code, there will be something like 
$('body').on('click','.saverecord',function(){ some code here }
$('body').on('click','.editrecord',function(){ some code here }

If you analyze the above code, you will see that the trigger is a click on the class called save, which executes an anonymous function that is embedded within braces.

So, a search for the keyword "saverecord" in the code will help you locate the flow of the program.

If you do not know how a jQuery code is organized, here is a short primer which tells you the framework of a jQuery code.

Sunday, February 19, 2017

The Secret to a Better Life

Is there any one thing, which if we do, we will have a better future?

I would say "Yes, there is".

BE STILL! Do nothing!

Essentially, we are all spiritual beings, who are here for a reason. We are given a chance to live life in a manner that benefits us and others.

As we see, each one of us experiences life differently, based on our past experiences, our past acts done out of anger, humility, love, greed and so on.

But, because of our limited knowledge of the universe and its workings, we are happy during good times and during bad times complain that God is being cruel to us for no fault of ours.

What we fail to realize is that whatever experiences that we are going through in our life, it is all the result of an accumulation of past activities; ours, our ancestors and our society. It has been called many names from ancient times, but for the sake of better understanding, we will call it Causal action.


The Buddha Story


You must have heard about this story about the Buddha. He used to go about the village everyday, seeking food from the residents. People used to give him food, while some desisted. But, there was one household, where the master of the house scolded him for begging for alms when he was hale and healthy. Why can't you go and do work? He rained the choicest abuses upon him. All the while, the Buddha maintained his silence. And, when the abuses stopped, he went on to the next household.

The next day, he went to the same households again and in this particular house, the master got even more angry and hurled more abuses seeing the Buddha again.

This happened every day for the next few days. The abuses became feebler as the days passed by, until one day, when this person asked the Buddha, "When I abuse you, you are not responding and talking back and not even trying to offer an answer. Are you not angry?". The answer the Buddha gave was "When you offer me something, it becomes mine, only when I take it from you. I have not accepted any of the abuses that you offered me during the past few days. They remain with you."

This is a profound incident, which should offer us some understanding of how the Universe works and how enlightened souls respond to stimuli.


The Secret of Life


There is another aspect to this which I would add here. The Buddha was shouted at by the householder, because of his past actions. At the time, the Buddha did the right thing of not responding to the householder, because that would mean that he is creating another "causal action", which would result in further responses on his life.

We are just looking at one single incident here. There may be umpteen such incidents that will happen in our entire life. When we stop reacting aggressively to all that is happening that is causing us distress in our life, we reduce the "accumulated causal action" from our debt and hence our later life would be better than it is right now.

So, there you are, with the most important secret to our life;

In short, BE STILL! DO NOT REACT AND TAKE LIFE AS IT COMES!

No, this does not mean that we do nothing. What it means is that we do all the things that we do everyday, while refraining from doing things that adversely affect others, while not reacting to bad things that happen to us.

Friday, February 10, 2017

Why is there so much suffering in the world


If God is real then why is there so much suffering?
How can there be a God who can allow all this atrocities to happen?

These are the kind of questions that arise in most minds, whether they follow any of the world's religions such as Christianity, Buddhism, Islam or other religions or atheism or neutral in their belief.

The philosophical answer to this is that it is the destructive actions of humans that caused it. Then, the reactions of humans to the ills happening to them perpetuates it.


The top executive is concerned with macro issues


The logical answer to this is that assuming there is a God, He is not coming down to help you out of a fix, in the same manner that President Obama or whoever is your head of state, is not going to come down to you and help you out of a fix.

The top person never addresses micro level problems; their focus is at the macro level.


We are responsible for our actions, nobody else


Next, whatever problems that we are in, are the result of our past actions. This is explained by the fact that we studied well in school, or excelled in a sport and are well placed in our life today. On the other hand, another set of students, wasted their time, watching movies, getting into bad habits and now are in a precarious position in their life. 

How is it that we can blame God for our actions? We get an interest from a bank only when we deposit money in the bank. We have to pay interest if we have taken a loan.


It is called Karma

Newton said, for every action, there is an equal and opposite reaction.

The same rule works for every action of ours, good or bad. Only that the results are manifold, not just in the ration of 1:1

For every good deed that you do, the benefits come to you many times over. Similarly, for all the bad deeds we have done, the punishments are going to be manifold too.


Why is the person doing bad deeds living a grand life?

The most repeated question against the existence of God is "If there is a God, then why are bad people not punished?". How do we know they are not punished? The fact remains that we are viewing life from a small key hole. We do not get the whole picture.

Let us again take the example of the bank deposit here. The deposit that we put in a bank accrues interest only after a specific time. 

All the bad deeds that we do are like an overdraft from a bank, you are allowed to draw so long as your deposits allow. And whatever you draw, you have to pay back.

Similarly, all the bad deeds that we do will begin to hurt us only after our deposit has become negative.

Man is now a symbol of destruction.

Man has forgot to live in harmony with the nature.

Man has forgot to live in tune with the system.

Man has become greedier in search of material possessions...

Once we stop or fail to reflect on our actions, suffering is invariably the end result.



Sunday, January 08, 2017

Steps to install wkhtmltopdf in Centos 7 Redhat

Steps to install wkhtmltopdf in Centos 7 Redhat


As you may know, wkhtmltopdf is a tool that is used to create a pdf on the fly from the Linux/Unix shell from any html document
Step 1 is to create a html document
Step 2 is to call wkhtmltopdf with the html document as input and pdf as output

But, before that, we need to install wkhtmltopdf in the Linux server machine.

Install wkhtmltopdf in Centos 7

Before we install wkhtmltopdf, we need to install the dependencies or support packages, which are required for wkhtmltopdf to work as expected.

So, we execute the following steps.

i. sudo yum install -y xorg-x11-fonts-75dpi
ii. sudo yum install -y xorg-x11-fonts-Type1

Let us get the rpm package from the link gna.org using the link below.
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

sudo rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

error: Failed dependencies:
        libXext is needed by wkhtmltox-1:0.12.2.1-1.x86_64
        libXrender is needed by wkhtmltox-1:0.12.2.1-1.x86_64

As you can see, there are two libraries that are missing. Let us install them too.


Install dependencies libXext libXrender for wkhtmltopdf


iii. sudo yum install libXext libXrender

Loading mirror speeds from cached hostfile
 * base: mirror.web-ster.com
 * epel: mirrors.cat.pdx.edu
 * extras: mirrors.xmission.com
 * updates: centos.eecs.wsu.edu
Resolving Dependencies
--> Running transaction check
---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed
---> Package libXrender.x86_64 0:0.9.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved



Installing:
 libXext                                  x86_64                               1.3.3-3.el7                                    base                                39 k
 libXrender                               x86_64                               0.9.8-2.1.el7                                  base                                25 k



Install  2 Packages

Total download size: 64 k
Installed size: 127 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libXrender-0.9.8-2.1.el7.x86_64.rpm                                                                                                      |  25 kB  00:00:00
(2/2): libXext-1.3.3-3.el7.x86_64.rpm                                                                                                           |  39 kB  00:00:00

Finally, let us try installing the rpm package again.

iv. sudo rpm -Uvh wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:wkhtmltox-1:0.12.2.1-1           ################################# [100%]

We have successfully set up and installed wkhtmltopdf on our machine.

Now, let us test if the module is working. We will try to create a pdf document  out of Google's first page.

wkhtmltopdf https://www.google.com google.pdf

Wednesday, January 04, 2017

Call to undefined function mcrypt_encrypt() in ... on line ...

Call to undefined function mcrypt_encrypt() in ... on line ...


When porting from my local server to the live server for testing, the php page was not loading and returned an Error 500 or Internal Server Error.

Analyse Apache error logs


As a first step, we tried to analyse the apache error logs to shortlist the reasons. The following line seemed to hold the key to the problem.

PHP Fatal error:  Call to undefined function mcrypt_encrypt() in /path/to/myAppFolder/myFile.php on line 13

Identify the problem


Missing php-mcrypt module


The issue seems to be related to a missing module in the Centos server. The php program was using the php-mcrypt module and it was not yet installed on the server yet.

Install php-mcrypt and restart Apache


So, we installed the php-mcrypt module using the below command

sudo yum install php-mcrypt

As a final step, we restarted the Apache Web Server

sudo systemctl restart httpd

Calling the php program now does not generate error now. Problem of Call to undefined function mcrypt_encrypt()  SOLVED.

Tuesday, January 03, 2017

Ajax call not working as expected in Firefox


Ajax call not working as expected in Firefox

Okay, I had this peculiar problem of my web form updating the relevant tables when being called from Google Chrome and not doing so, when the call was made through Firefox.

The form went into sleep and did not respond after the Submit button was clicked. It looked as if the Ajax call was in indefinite loop in Mozilla Firefox.

As we went digging for reasons that this was happening, we realised that Firefox is strict about how data has to be sent to it.

Google Chrome is someone who tries to make sense out of the data and so, we got away with Chrome.

So, we understand that what we need to return from a php, which is being called through an ajax request, is content preceded by a header, which indicates the type of content that follows.

It could be any of these types as defined below.

Header Content-type: Common examples:
application/json
application/x-www-form-urlencoded
application/pdf
multipart/form-data
text/html
text/plain
image/png
image/jpeg

image/gif

So, at the end of your php code, you will  have something like what you are seeing below. In the first example, the returned value is a json content, while the second example returns a plain text message in response to the Ajax request.

Php program returning JSON in response to an Ajax call, Example 1:


    header('Content-type: application/json');
    echo json_encode($response_array);
?>


Php program returning text value to Ajax call, Example 2:


    header('Content-type: text/plain');
    echo 'success';
?>