How to include JSON data in javascript synchronously without parsing?

getJSON() is simply shorthand for the ajax() function with the dataType:'json' set. The ajax() function will let you customize a lot about the request.

$.ajax({
  url: "https://stackoverflow.com/questions/4116992/MyArray.json",
  async: false,
  dataType: 'json',
  success: function (response) {
    // do stuff with response.
  }
});

You still use a callback with async:false but it fires before it execution continues on from the ajax call.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)