ExtJS in Ext.Ajax.request and Form1.getform (). The basic difference between submit

Source: Internet
Author: User

The same point: all belong to the Ajax submission Method!

Different points: Ext.Ajax.request is an example of Ext.data.connection

Form1.getform (). Submit is a way to implement Basicform

The difference in use:

1.form1.getform (). Submit is often used when a form is submitted, that is, to submit page data, such as adding and modifying data pages

2.ext.ajax.request is commonly used when submitted according to the parameters, such as delete, we will select the page ID to traverse, encapsulated in an array, as a parameter to do Ajax submission

Example:

The first is the Form1.getform (). Submit Example:

Function formsubmit () {   if  (Form1.getform (). IsValid ())  {     form1.getform (). Submit ({     waittitle :  ' hint ',//title       waitMsg :  ' submitting data Please later ... ',//prompt Information      url :  ' Eidtbooktype.action ',     method :  ' post ',      params :  ' BookType ',      success : function (form, action)  {      var flag=action.result.msg;       window.returnvalue= ' SUCC ';        ext.msg.alert (' Hint ', flag,function () {        window.close ();       });      },     failure : function (form,action)  {       var flag=acTion.result.msg;      ext.msg.alert (' operation ',  flag);      }    });    }}

Next is an example of a Ext.Ajax.request:

Ext.Ajax.request ({         url :  ' Deletebooktypes.action ',        method :  ' post ',         params : {delids:deleteids.tostring ()},         success : function (form,action)  {          //alert (response.responsetext);  //returns the JSON value of the string           var resptext = ext.util.json.decode (form.responsetext);  //bar string into JSON format          var msg=respText.msg;          ext.messagebox.alert (' Hint ', msg,function () {           booktypestore.reload ();          });         },        failure : function (response,options)  {          var resptext = ext.util.json.decode ( Response.responsetext);  //bar string into JSON format          var msg= Resptext.msg;         ext.messagebox.alert (' Hint ', msg,function () {           booktypestore.reload ();          });        }        });

The difference between using the Yes:

The most obvious is the success and failure time function parameters!

The Ext.Ajax.request function (response,options), option is very useful, Use Response.responsetext to get the return parameter, note that the response parameter of this place can be changed to action

Form1.getform (). Submit function (form, action), action is useful, use action.result.msg to get the return value

There is one of the most obvious difference is Ext.Ajax.request can not use waitmsg, really ext a failure!!!

There is also one of the most noteworthy places:

Form1.getform (). The value returned by the submit must contain success:true or failue:true

This is the final judgment of the success of the key!!!

And Ext.Ajax.request do not need this parameter, as long as the exception is not thrown, it must be success success!!!


ExtJS in Ext.Ajax.request and Form1.getform (). The basic difference between submit

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.