Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In jQuery-1.7.2.js, there is a gray area from when the dynamic jsonp request script is loaded (line 8123 thereabouts) to when a response is received from the server and the callback installed on line 8016 is invoked. It appears as though this call back, even though defined in a global scope on the window object, does not exist under certain circumstances. Layout of children elements under this window object does have something to do with it as invoking ajax by clicking on a checkbox laid directly on an ASP.NET razor partial view works but when invoked from a button within an OpenLayers.Popup.FrameCloud you run into this problem.</p> <p>A workaround is to prevent jQuery from defining a random function as the jsonp callback as follows:</p> <pre><code>$.ajax({ type: 'GET', url: "http://open.mapquestapi.com/nominatim/v1/search?format=json&amp;viewbox=-122%2C46%2C-73%2C40&amp;countrycodes=ca&amp;bounded=1&amp;addressdetails=0&amp;q=[hotel]&amp;json_callback=onSearchComplete", dataType: 'jsonp', jsonp: false, error: function(parameters) { alert(parameters); } }); </code></pre> <p>where in this case 'onSearchComplete' is a global function defined in your script. With this setup, onSearchComplete will always be called upon successful server response, regardless of how the ajax query is invoked. Problem in this case is that jQuery still creates and installs the randomly named callback function even though it is not being sent as part of the json request. As a result, the randomly generated callback will never be executed and causing jQuery to treat this as an error condition.</p> <p>Maybe the jQuery gurus can shed more light here.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload