Ajax return cannot be less; otherwise, Ajax functions cannot be stimulated.

Source: Internet
Author: User

It took dwz Ajax a day to get used, @ using (HTML. beginform ("edit", "xuenianxueqi", forpolichod. post, new {onsubmit = "Return validatecallback (this, dialogajaxdone)"}), return cannot be small, otherwise Ajax functions cannot be stimulated

 

Submit and onsubmit
Order of occurrence: onsubmit-> submit

1. Block Form ticket submission:

<SCRIPT>
Function submitfun ()
{
// Logical judgment
Return true; // allow form submission
// Logical judgment
Return false; // form submission not allowed
}
</SCRIPT>
<Form onsubmit = "Reture submitfun ();"> // note that onsubmit = "submitfun ();" cannot be written here. Otherwise, the form is always submitted.
</Form>

2. onsubmit () and submit ():

<SCRIPT>
Function fun ()
{
Alert ("form_submit ");
}
</SCRIPT>

<Form onsubmit = "Fun ()">
<Input type = "Submit" id = "AAA" value = "Submit"> <! -- Form_submit -->
<Input type = "button" id = "BBB" value = "onclick_submit" onclick = "document. Forms [0]. Submit ()">
<! --
The form is submitted, but fun () is not executed because the onsubmit event cannot be triggered in this way (in the IE environment)
Directly Using the script documetn. formname. Submit () to submit a form does not trigger the onsubmit () event of the form.
-->
<Input type = "button" id = "bb1" value = "onclick_onsubmit" onclick = "document. Forms [0]. onsubmit ()">

<! -- Triggers the fun () function -->
</Form>

 

Http://www.okajax.com/a/200811/1124R012008.html

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.