I am providing a sample code here where I am sending data to php script in response I am able to get values in data from xmlhttp responseText But the issue is I am not able to parse it using JSON parse
Here is the code :
I am able to alert data
var xmlhttp;
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ //alert("hiiiiiiiii");
var data = xmlhttp.responseText;
alert(data);
//alert(data123.taxi_sr_no_array);
obj=JSON.parse(data);
//alert("object is :" + obj);
//alert(obj.taxi_no_of_rows+'
'+obj.taxi_sr_no_array+'
'+obj.taxi_imei_number_array+'
'+obj.taxi_latitude_array+'
'+obj.taxi_longitude_array+'
'+obj.taxi_hemisphere_array);
alert(obj.taxi_no_of_rows);
}
}
xmlhttp.open("GET","<?php echo site_url()."/welcome/taxi_ajax_data";?>",true);
xmlhttp.send();