EXTJS6 set the store, Ajax, form request mode (GET, POST) __jsp

Source: Internet
Author: User

The AJAX request and form's Submit method set the request in the same way as it did, using method: ' POST ' settings

		Form submission
		Winform.getform (). Submit ({
			waittitle: ' Hint ',//title
			waitmsg: ' Submitting data Please later ... ',//prompt info
			url: '. /.. /.. /dayreportcontroller/add.do ', method
			: ' POST ',
			params: {//Here you can add additional parameters
				Extraparems: ' Extraparems '
			},
			success:function (form, action) {
				/
				 * * The second method gets the return value of
				var success = action.result.success;
				Alert (success);
				* *
				
				var resptext = Ext.util.JSON.decode (action.response.responseText)
				if (resptext.success = = True) {
					Ext.Msg.alert (' message ', ' save success. ');
					EXT.GETCMP (' win '). Close ()///Add Success closes the window
					ext.getcmp (' Menugrid '). GetStore (). reload ();
				{
					Ext.Msg.alert (' message ', resptext.msg);
				}
			},
			failure:function (form, action) {
				Ext.Msg.alert ("message", "Operation failed!");
			}
		);


		Ext.Ajax.request ({method
			: ' POST ',
			URL: '.. /.. /.. /dayreportcontroller/deletemenu.do ',
			params: {
				' ID ': ID//To delete the ID of the record
			},
			success:function (response, Config) {
				*
				//background: Out.print (1);
				var result = Response.responsetext;
				if (parseint (result) = = 1) {
					ext.getcmp (' Menugrid '). GetStore (). reload ();
					Ext.Msg.alert ("Hint", ' delete succeeded! ');
				} else {
					Ext.Msg.alert (' Hint ', ' delete failed! ');
				}
				*
				
				//Backstage: Out.print ({success:true});
				var json = Ext.util.JSON.decode (response.responsetext);
				if (json.success = = True) {
					ext.getcmp (' Menugrid '). GetStore (). reload ();
					Ext.Msg.alert ("Hint", ' delete succeeded! ');
				} else {
					Ext.Msg.alert (' Hint ', ' delete failed! ')
				}
			,
			failure:function () {
				Ext.Msg.alert (' Hint ', ' delete failed! ');
			}
		});


Store Setup request method using Actionmethods: {

READ: ' POST '

}


	    var store = ext.create (' Ext.data.Store ', {
			//autoload:true,
			pageSize:main.gridPageSize,
			fields: [' id ', ' Text ', ' description ', ' url ', ' leaf '],
			proxy:new Ext.data.HttpProxy ({
				type: ' Ajax ',
				URL: ' ... /.. /.. /dayreportcontroller/test.do ',
				actionmethods: {
					read: ' POST '//Store the method of setting the request is different from the AJAX request
				},
				Reader : New Ext.data.JsonReader ({
					type: ' JSON ',
					rootproperty: ' Data ',//(not configured to receive data), key
					returned Totalproperty: ' Totalrecord '//record number (cannot be paging without configuration), return key is Totalrecord})})
		;


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.