jsonp cross domain ajax call
What is JSONP?
Jsonp is basically json formatting with padding. The padding essentially is set by the server side to automatically call the javascript function that is passed in in the default callback function. That is for example if our ajax is as follows:
$.ajax({
url: "http://someotherdomainurl/",
dataType: "jsonp",
data: {
search_term: request.term
},
success: function( data ) {
response( $.map( data, function( item ) {
return {
label: item.label,
value: item.id
}
}));
}
});