I am calling a YUI function to get status message from a php function that return the proper status in json format.
when i trigger the event in gives the error message :-
"Syntax error unexpected token u"
Here is the source :-
var ajax_url = 'initcalls.php?action=ping';
var pngbtn = Y.one('#id_solr_btn_ping');
pngbtn.on('click', function(e) {
Y.one('#solr_ping_status').setHTML(' <img src="pix/ajax-circle.gif">');
Y.io(ajax_url, {
on : {
success : function(data) {
try
{
var resp = Y.JSON.parse(data.responseText);
}
catch (e)
{
alert(e);
return;
}
if (resp.status == 'ok') {
Y.one('#solr_ping_status').setHTML(' <img src="pix/success.png">');
timeout("clearSaveStatus('#solr_ping_status')",2000);
}
else {
Y.one('#solr_ping_status').setHTML(' <img src="pix/warning.png">');
}}
}
});
return false;
});
My php file return the following result:-
{"status":"ok"}