javascript - Execute your own JSONP function -
i using jsonp , , url(action) returning me function called processtemplates. there way can execute own function instead of processtemplates.
something _processjsoncallback
function _processoveridecallback(actionname) { $.ajax({ type: 'get', url: actionname, async: false, contenttype: "application/javascript", jsonpcallback: '_processjsoncallback', datatype: "jsonp", error: function(jqxhr, exception) { if (jqxhr.status === 0) { alert('not connect.\n verify network.'); } else if (jqxhr.status == 404) { alert('requested page not found. [404]'); } else if (jqxhr.status == 500) { alert('internal server error [500].'); } else if (exception === 'parsererror') { alert('requested json parse failed.'); } else if (exception === 'timeout') { alert('time out error.'); } else if (exception === 'abort') { alert('ajax request aborted.'); } else { alert('uncaught error.\n' + jqxhr.responsetext); } } }); };
but when trying throwing exception "requested json parse failed."
please me on this.
from jquery docs:
cross-domain requests , datatype: "jsonp" requests not support synchronous operation
you getting error because have async: false
.
Comments
Post a Comment