Submit a jquery mobile form via Ajax and PHP (two articles)

Source: Internet
Author: User
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)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.