Skip to content
Advertisement

JQuery getJSON Disable Global Events

is there a way to disable global events inside a JQuery $.getJSON function ?

The documentation only mention that the global property is available for an $.ajax call, but nothing about $.getJSON.

There reason I want to deactivate is that I have a global ajaxStart event that I want to not handle the async JSON file reading.

Any possible solution ? Do I have to convert the $.getJSON function to an $.ajax call ?

This is what I am trying to solve but for an async $.getJSON file event.

Advertisement

Answer

There is no available way to disable global events in a $.getJSON.

I had to convert it to regular AJAX call from docs.

Changed this

$.getJSON(strUrl, function(response_data) {...

to this

$.ajax({
    dataType: "json",
    url: strUrl,
    global: false,
    success: function(response_data) {...
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement