javascript - Updating a select box without causing onChange -


What do I want to achieve here, I have a selection box that loads in some rows, when the selection changes The (onchange) key is used in the PHP function as AJAX, which gives an array in JSON format, then my code selection box clears options and applies the values ​​that I have just returned from my PHP function .

The problem when the new values ​​are set, it fires the on-event event again, it sets the value and we are in the beginning of a non-ending loop, there is an error in firebug Goes out and goes out of it.

My question is that there is a way to disable the incident of attack, so it only takes a fire. I am coding in a structure around the prototype, posting a code example would be a bit heavy, although I can try to fill any missing data on the request.

Cheers! ILMV

Using flag variable, worry about stopping onchange Instead, wrap your logic in a conditionally condition based on a flag variable. Basically you can only create a variable , and set it to false when you are updating the program, then, onchange logic Check the value of that variable if it is wrong, do not do anything, but toggle it to the next onchange event true if it is true, then its Make specific AJAX requests for data.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -