开发者

How to pass multiple callback parameters inside a jQuery asynchronous ajax call?

I am starting to use some basic ajax calls in jQuery. The call works well, but I want to pass additional parameters to the callback function in addition to the ajax response. The additional variables I want to pass are: map_div, data_n开发者_开发技巧ame, var_name

It's not clear to me how I can pass those through the callback function (DrawWoldMap). Anyone know the syntax for that?

google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(OnLoad);
function OnLoad() {
   $.ajax({
      type: "POST",
      url: 'chart_feeds/parcel/map.php?start='+from_date+'&end='+to_date,
      data: '{}',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: DrawWorldMap
   });
}


Replace DrawWorldMap with the following snippet:

function (response) {
    DrawWorldMap(response, map_div, data_name, var_name);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜