I am sending data from index.php fiel to another exec.php file using $.ajax method and executing the data on that file now when i am sending back output data using jsonp callback i am getting incorrect data on index.php. I am also writing same output data into a txt file on exec.php and i am getting correct data in txt file.
here's my ajax call from index.php
$.ajax({
type: 'GET',
url: 'exec.php',
dataType: 'JSONP',
data: {code : code},
success: function(data)
{
alert(data);
$(loader).addClass('hidden');
var stdout = $(form).children('.stdout');
if (data.search("Parse error")>0)
{
var str = data.replace('<b>Parse error</b>: ','');
$(stdout).html(str);
$(stdout).removeClass('hidden');
}
else
{
$(stdout).html(data);
$(stdout).removeClass('hidden');
}
},
error: function (status,req,err) {
var errorMessage = err || req.statusText;
alert(errorMessage);
}, // When Service call fails
responseType: "jsonp"
});
Here's my json callback code from exec.php
print "processJSON({'result':'$result'})";
Now here's the response i am getting in firebug.
Screenshot - http://screencast.com/t/nqdAR7JedMk I'm getting this error by alert through error of ajax method Screenshot - http://screencast.com/t/5RRlYiha2C0
Please suggest me what i am getting wrong