Extjs Ext. Ajax. Request ({}) Params:

Source: Internet
Author: User
VaR store = new Ext. Data. Store ({

URL: "Hello. xml ",

Reader: New Ext. Data. xmlreader ({

Record: "row "},

["ID", "name", "Organization", "Homepage"])

});

Because the sote component accepts a parameter URL, if the URL is set, extjs creates an ext. data. httpproxy object through the specified connection or ext. ajax. request to send a request to the server to read data from the server.
Experience shows that generating JSON data on the server is a very good choice, that is, if the server URL "student. EJF? Cmd = List "generates the following JSON data output:

{Results: [{ID: 1,

Name: 'wang ',

Email: 'xiaowang @ easyjf.com ',

Sex: 'male ',

Borndate: '2017-4-4 '},

{ID: 1,

Name: 'lily ',

Email: 'xiaoli @ easyjf.com ',

Sex: 'male ',

Borndate: '2017-5-6 '},

{ID: 1,

Name: 'Alan ',

Email: 'xiaoxiao @ easyjf.com ',

Sex: 'female ',

Borndate: '2017-3-7 '}

]

}

The store that displays the learning information editing table can be created in the following format:

VaR store = new Ext. Data. Store ({

URL: "student. EJF? Cmd = List ",

Reader: New Ext. Data. jsonreader ({

Root: "result "},

["ID", "name", "Organization", "Homepage"])

});

Or:

VaR store = new Ext. Data. jsonstore ({

URL: "student. EJF? Cmd = List ",

Root: "result ",

Fields: ["ID", "name", "Organization", "Homepage"]});

Root indicates the attribute that contains the record set data.
If you are runningProgramWhen sending data to the server, you can directly use the request method of the Ext. Ajax object provided in extjs. For exampleCodeImplement student. EJF? Cmd = save this URL to initiate a request and specify the student object to be sent in Params:

 function SFN () 

{< br>
alert ('saved successfully ');

}< br>
function FFN ()

{< br>
alert ('Save failed ');

}< br>
Ext. ajax. request ({
URL: 'student. EJF? Cmd = save '
success: SFN
failure: FFN,
Params: {Name: 'lil', email: 'xiaoli@easyjf.com ', borndate: '1992-5-6', sex: 'male'}

});
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.