I am using AJAX to send values to PHP and retrieve the values from PHP. The problem is the value i am getting from PHP is viewed as undefined in AJAX. Please help me solve this
Please try this. 1. Use output buffering so that only json data will recieve in ajax response 2. Provide json datatype in ajax
Php Code
//empty the current contents of the output buffer
ob_end_clean();
// Turns on output buffering
ob_start();
// print output
echo json_encode(array("a" => "success", "b" => "timeout", "c" => "fail"));
// Turn off buffering and print the contents
ob_end_flush(); // Turn off buffering and print the contents
exit;