here is my ajax request function
function get_from_rss(div_id , link_ ){
jQuery.support.cors = true;
$.ajax({
url : link_ ,
contentType: "application/json",
dataType: 'jsonp',
jsonp : "callback",
jsonpCallback: 'callbackfunc'
});
}
here is my callback function
function callbackfunc (data)
{
// parse data
// put them in the right div
}
so the parsing part is similar for all of the links ( all links are json feeds from rss ) only thing different is that div , so i need to somehow send div id along with ajax result to callback function , otherwise i have to write separate callback function for each link
something like
function callbackfunc (data , div_id)
{
// parse data
$('#'+div_id).html(data);
}
function get_from_rss(div_id , link_ ){
$.ajax({
...,
jsonpCallback: function(data){
callbackfunc(data, div_id);
}
});
}
Are you sure it is jsonpCallback
you would want to use and not success
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.