Submit a jquery mobile form via Ajax and PHP
File name:callajax.php
<?php $firstName = $_post[firstname]; $lastName = $_post[lastname]; Echo ("First Name:".) $firstName. "Last Name:". $lastName); ? >
File name:index.php
<! DOCTYPE html>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
JQuery Mobile Form Submission
http://blog.csdn.net/tjpu_lin/article/details/28394253
I recently developed a mobile phone page with jquery mobile and encountered a problem when it was submitted to the form form.
The background is to use the servlet processing, want to through the servlet inside the redirect page jump forwarding is now no use on the phone, there is errorpage prompt information.
Query the online information and jquery Mobile API that the jquery mobile form submission By default is the AJAX submission, so the page jump write in the servlet will not implement the page jump function.
So I follow the tutorial in the form inside add data-ajax= "false" this attribute, found not to say is page jump not, even the background database operation can not do, reported 500 errors.
Think for a long time since using AJAX to submit, then use AJAX to page jump
<script type= "Text/javascript" > $ (document). Ready (function () { $ ("#submitbtn"). Click (function () { Cache:false, $.ajax ({ type: "POST", URL: "Feedback", data: $ (' #feedbackform '). Serialize (), success:function (data) { $.mobile.changepage ("success.html"); } ) ;});
<form method= "POST" id= "Feedbackform" > t;span style= "White-space:pre" > </span>//Related form elements <input type= "button" id= "Submitbtn" value= "Submit" > </form>
Note that the data in JS
$ (' #feedbackform '). Serialize ()
Is must have, otherwise the servlet inside with Requset.getparameter accept data is null,ajax and background successful interaction with changepage jump to success after the page displayed.
The above describes the use of Ajax and PHP, the submission of the jquery mobile form (two), including aspects of the content, more related to Topic.alibabacloud.com (www.php.cn)!