Reputation: 31245
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_name, 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
});
}
Upvotes: 1
Views: 1581
Reputation: 31006
Replace DrawWorldMap
with the following snippet:
function (response) {
DrawWorldMap(response, map_div, data_name, var_name);
}
Upvotes: 2