Sunday 15 September 2013

php - why did my ajax not submitting? -


I have a problem sending the AJAX form and where the error is not available,

here Html:

  & lt; Form method = "post" id = "update-profile" name = "update-form" action = "process.php" & gt; & Lt; Input name = "user name" type = "text" id = "user name" value = "& lt ;? php echo $ username ;; & gt; /> ........ & lt; Input name = "update_profile" type = "button" class = "submit" id = "update_profile" value = "update" onclick = "return form validation ();" / & Gt;   

And this is my javascript:

  function form validation () {// Other assumptions here (legendsex (ux, ufsex)) {$ ( '#mydata'). Html ('Saving ... & lt; img src = "../ images / loading.gif" / & gt;'); $ Ajax ({url: "process.php", Data type: 'Jason', data: {id: document.getElementById ('iidd') Price, Username: document.getElementById ('Username'). Value, Name: Value, password: document.getElementById ('password') Value, slist: document.getElementById ('slist') value, gender: gender, update_profile: "update_profile", type: 'post', success: function (msg) { $ ('# Mydata') .HTML ("& lt; span & gt; saved successfully "). Delay (3000). FadeOut ('fast');}}}); } } } } } return false; }   

Also debugged with

  error: function (jqxhr, textstatus, errorThrown) {console.log (JSON.stringify (jqXHR) )); Console.log ("AJAX error:" + textstats + ':' + error restored); },   

And said: AJAX error: Undefined: undefined

So I do not know what the problem is.

Here My Process Php:

  if (isset ($ _ POST ['update_profile'])) {$ id = $ _POST ['iid']; $ Username = mysql_real_escape_string ($ _ POST ['username']); $ Name = mysql_real_escape_string ($ _ POST ['name']); $ Password = mysql_real_escape_string ($ _ POST ['password']); $ Country = mysql_real_escape_string ($ _ POST ['slist']); $ Sex = mysql_real_escape_string ($ _ POST ['gender']); // update query here   

thanks !.

You have data property

  Data: {ID: Document.getElementById ('IIDD') did not close the suspense. Value, user name: document.getElementById ('username') value, password: document.getElementById ('password') value, slice: document.getElementById ('slist') value, gender: gender, update_profile: "update_profile"} , & Lt; ---- It is missing   

and I do not understand the reason for all other additional braces in your code.

  Functional Validation () {// Other Validations Here (Legitimate (UX, UFCX)) {$ ('# mydata'). Html ('Saving ... & lt; img src = "../images/loading.gif" /> & gt;'); $ Ajax ({url: "process.php", Data type: 'Jason', data: {id: document.getElementById ('iidd') Price, Username: document.getElementById ('Username'). Value, Name: Value, password: document.getElementById ('password'). Value, slice: document.getElementById ('slist') value, gender: gender, update_profile: "update_profile"}, type: 'post', success: function (msg) {$ ('# Mydata') .HTML ("& lt; span & gt; successfully saved & lt; / span & gt;") .delay (3000). FadeOut ('sharp');}}); } return false; }    

No comments:

Post a Comment