Note that there are some explanatory texts on larger screens.

plurals
  1. POgetJSON call fails unless single stepped
    text
    copied!<p>I have a application that has a home page w/ a form w/ check boxes; the chk-bxs represent column-data to return from a MySQL db. </p> <p>The behavior I’m trying to achieve is:</p> <ol> <li>User checks / unchecks boxes on home page</li> <li>User clicks link to page that will run the query</li> <li>Server receives the check boxes states through a getJSON call, triggered by the unload of the home page. PHP loads $_SESSION[] w/ chk-bxs states</li> <li>Server then process the link call using the data in $_SESSION[] to determine what column data to return and display in result in a table</li> </ol> <p>I CAN achieve this IF I put a break point at the last member assign of the getJSON call and single stepping it. Without the single-step, the getJSON call doesn’t seem to happen; so the chk-bxs values don’t get transmitted to the server. Can anyone explain this behavior? Is there a better way to approach the problem? Any thoughts would be appreciated. </p> <p>This is the code in the head section of the index.php file that calls the function that will do the getJSON call:</p> <pre><code>$(window).on('beforeunload', function(){ indexFormUnload(); // this saves the state of the SELECT check-boxes }); </code></pre> <p>This is the code that constructs the getJSON call - it resides in a separate file included in the index.php file:</p> <pre><code>function indexFormUnload(){ var ckBxValues = $(":input").serializeArray(); $.getJSON("ajaxJQ_server.php", // server page called by jquery { // Data sent via ajaxJQ "callingForm": "index", "callingElementID" : null, "locStorage": ckBxValues, "callingState": "unload", "tableName": null } ); } </code></pre>
 

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