Ajax submission in jquery. form in IE does not respond to solution sharing

Source: Internet
Author: User

It took three hours to check and find that the returned header information of the page was changed.
When application/x-javascript is added, ie8 will not work.
If it is text/html, it is OK, or if it is not specified.
Is it a bug? Let me greet the ie developers who wrote this code.
Ajax header information, encoding seems to have to pay attention to it.
How to submit form data using ajax

Url parameter submissions
Copy codeThe Code is as follows: <script type = "text/javascript" src = "../js/jquery. js"> </script>
<Script type = "text/javascript">
Function checkCorpID () // checks whether the customer ID is available
{
If ($. trim ($ ("# txtF_CORPID") [0]. value) = "") // txtF_CORPID is the customer ID input box
{
Alert ("Enter the customer ID! ");
}
Else
{
$ ("# CheckFlag" ..html ("detecting"); // display the prompt information
$. Ajax ({
Type: "get ",
Url: "CheckCorpID. ashx ",
Data: "ID =" + $. trim ($ ("# txtF_CORPID") [0]. value), // submit a form, equivalent to CheckCorpID. ashx? ID = XXX
Success: function (msg) {$ ("# checkFlag" ).html (""); alert (msg) ;}// the operation after the operation is successful! Msg is the value passed from the background.
});
}
}
</Script>

Ii. Front-end code for Form to submit data:
CodeCopy codeThe Code is as follows: <script type = "text/javascript" src = "../js/jquery. js"> </script> // must be referenced
<Script type = "text/javascript" src = "../js/jquery. form. js"> </script> // must be referenced
<Script type = "text/javascript">
// Wait for the DOM to be loaded
$ (Document). ready (function ()
{
$ ('# Tip'). hide (); // The elements that display the operation prompt are invisible.
$ ('# Form1'). submit (function () // submit the form
{
// Alert ("ddd ");
Var options = {
Target: '# Tip', // the backend will assign the passed value to this element.
Url: 'returnvisit. aspx? Flag = do ', // to which execution is submitted
Type: 'post ',
Success: function () {alert ($ ('# Tip'). text ();} // displays the operation prompt
};
$ ('# Form1'). ajaxSubmit (options );
Return false; // in order not to refresh the page, false is returned. It has been executed in the background. It's okay!
});
}
);
</Script>

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.