1

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
   });
}
1

1 Answer 1

2

Replace DrawWorldMap with the following snippet:

function (response) {
    DrawWorldMap(response, map_div, data_name, var_name);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.