javascript - Race-condition when submitting form with jQuery -


I have to make a hack to be able to submit a form (non-ajax) using jQuery.

If I do not do the not statement, the form will not be submitted:

This work (form has been submitted)

  $ ("# myHiddenFieldID") Val (JSON.stringify (jsObject)). Var x = $ ("# myHiddenFieldID"). Val (); If (x) {$ ("# myHiddenForm"). Submit (); }  

This does not work (the form submission field is not empty)

  $ ("# myHiddenFieldID"). Val (JSON.stringify (jsObject)); Var x = $ ("# myHiddenFieldID"). Val (); // I used to place a warning here, the text that appeared in the text field was shown earlier ....... $ ("# MyHiddenForm") presented ().  

I do not understand why I want to read the contents of the text field here ...

, the assignment statement is executed before the value of the text field:

  var x = $ (" # myHiddenFieldID "). Val (); $ ("# MyHiddenFieldID") (JSON.stringify (jsObject)). $ ("# MyHiddenForm") presented ().  

Comments

Popular posts from this blog

python - Assemble mpeg file unable to play in mediaplayer -

c# - crystal report failed -

mongodb - CakePHP paginator ignoring order, but only for certain values -