php - serialize ajax post send old input values -


i have form input fields , button. when click button form serialized , data sent php file stored in database.

i use $("form.step1").serialize(); , when alert() data correct values, ajax post sending old values. when send input field data 1 one, form works fine:

$('button#nxt').on("click", function (event) {     event.preventdefault();     var formdata = $("form.step1").serialize();     alert(formdata);     $.ajax({         type: "post",         url: "/app/secure/includes/process_create_account.php",         //data: { step: "1", user_name: ""+$('input[name="user_name"]').val()+"", user_company: "test" },         data: formdata,         success: function (data) {             console.log(data);         },         error: function (xhr, status) {             alert("sorry, there problem!");         },         complete: function (xhr, status) {}     }); }); 

why $("form.step1").serialize(); not work in case?


Comments