webforms - jQuery .val() not updating on submit -


I have the following values ​​that are used by jQuery in any form .val ():

  var un0 = $ ("input.e0"). Val (); Var un1 = $ ("input.e1"). Val (); Var un2 = $ ("input.e2"). Val (); Var un3 = $ ("textarea.e3"). Val ();  

The original values ​​from the elements have already been added by separate scripts that release values ​​from AJAX XML data.

The problem is that when I edit the values ​​in the form (i.e. overwrite them) and submit the form to update my DB, the original value , Updated values ​​are sent instead of It looks like new values ​​are being ignored .val () If I'm posting with a warning from the exam (un0); The newly edited value has not been recovered and I can see that the original is being used.

Note This is not the case for textarea (un3) which is working correctly, and updates with a new value on editing.

Any ideas why jQuery is not using new inventions?

Edited with more sources:

The values ​​after the XML call from DB are set in the previous code blocks. This is executed when an item is clicked. Create output information (for both reading and writing) for

  // (var i = 0; i & lt; field_count; i ++) {data = eval ("R "+ I); $ (". R" + i) .replaceWith ("& lt; span class = \" r "+ i +" \ "& gt;" + data + "& lt; / span & gt;"); $ (". E" + i) .attr ("value", data); }  

Then a read-only version is displayed. There was a link that closes the read-only version and starts the form with the same values.

Then submit the overwrite function to jQuery call: Click

  $ ("overwrite") (function () {// Other condition, then ... if (Category == "3") {// Phone var un0 = $ ("input.e0"). At ('value'); var un1 = $ ("input.e1"). Attr ('value'); Var un2 = $ ("input.e2"). Attr ('value'); var un3 = $ ("textarea E3"). Val (); // Merry A0 = passpac.xode using each "AES", N00, Mikey); A1 = Passack.exode ("AES", N1, Mikey); E2 = Passpac.Ncode ("AES", United Nations 2, Mikey); E3 = Passpac Xcode ("AES", A 3, mike); query string = 'user_id =' + user + 'and ati-cat_name =' + cat_name + 'and amp; id =' + item_no + '& amp; vp; v1 =' + e0 + 'and v2 = '+ E1 +' & amp; v3 = '+2 2' & amp; v4 = '+ e3;} // Other condition, then ... // edit call php to db $ .ajx ({type: $ ("# Edit_" + cat_name) .hide ($); $ ("# Delete_success"); "post", url: "app / edit.php", data: query string, success: to update. Hide () .; $ ("# Right_read") Show ().; $ ("# Write_success") Show ().; $ ("# Read_" + cat_name) Show (); Get_list (0, category); Read_db (category, item_no); }}); time up(); return false; });  

The value in the form is not updated after the edit, and the submission uses the original values ​​as determined by the above code.

You can STH this way to get value after clicking on the button: < / P>

  $ ('submit'). Function () {var un0 = $ ("input.e0"). Val (); Var un1 = $ ("input.e1"). Val (); Var un2 = $ ("input.e2"). Val (); Var un3 = $ ("textarea.e3"). Val ();});  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -