$.ajax({
url: 'url',
jsonpCallback: "JSON_CALLBACK",
dataType: 'jsonp',
contentType: 'text/plain',
success: function(json) {
console.log(json);
alert("Success"); },
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
alert('Failed!'); },
});
Context :- When JSONP is used for cross domain calls we need to send a parameter '&callback=JSON_CALLBACK ' in this case can we need to alter the output from server to return result wrapped with JSON_CALL
url: 'url',
jsonpCallback: "JSON_CALLBACK",
dataType: 'jsonp',
contentType: 'text/plain',
success: function(json) {
console.log(json);
alert("Success"); },
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
alert('Failed!'); },
});
Context :- When JSONP is used for cross domain calls we need to send a parameter '&callback=JSON_CALLBACK ' in this case can we need to alter the output from server to return result wrapped with JSON_CALL
No comments:
Post a Comment