Question about Ajax form submission

Source: Internet
Author: User
Tags php source code

Introduction: This is a detailed page for Ajax form submission. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 332634 'rolling = 'no'>
For two consecutive nights, I have been searching for a problem. The same data, the same method (the front and back ends are the same), but the browsers are different. One is IE6 and the other is ff and chrome, but the problem is that in IE6, after Ajax is submitted, the parameters get the normal return value and data. The other two always return an error. In other words, in IE, all newly added or modified content can be submitted normally. In ff and chrome, some requests are successfully submitted, and some cannot be submitted, and return an error message?

SeeCode:

 
   
   
  
Name:

display on the frontend topic name, such as homepage and news...

....
submit
VaR Param = [{Name: 'names', value: $ ("# names "). val ()}, {Name: 'id', value: Id}, {Name: 'pid ', value: PID}, {Name: 'code', value: $ ("# Code "). val ()},]; $. ajax ({type: "Post", timeout: 2000, datatype: "JSON", URL: "{: U ('Global/doajaxsave')}", data: Param, error: function (text) {alert ("error:" + text.info); window. location. reload () ;}, success: function (text) {alert (text.info); window. location. reload ();}});

There is a save operation in the background, and the methods are shared. This background method works normally in other modules. That is to say, some background problems are solved at the front-end. The same error message is returned when you delete one line of code in HTML. Later, I submitted the code several times in IE and suddenly found that the window was refreshed twice. Once reload () is Refresh, it is normal. But what else?

I tried to delete lines of JS Code. After I tried it, I only had HTML and refreshed it twice. Does that mean I submitted it twice? I checked the HTML. I think there is no problem. There are only two rows <form>... </form>. Why are there two rows? Deleted. Try again. At this point, the culprit has been identified.

I thought for a moment, it may be that AJAX uses the post submission method, and the page has another from form. Therefore, it may be that two submissions are triggered from the page at the time of submission. So this strange problem has always occurred. But what's even more confusing is, why did you add another <form> tag ?..... Cup, depressed .......

More articles about "ajax form-submitted problems"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/332634.html pageno: 11.

Related Article

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.