JS front-end Ajax Submit list set parameters to back end __js

Source: Internet
Author: User

JS Part
			var ordernoslist = new Array ();
			var rows = $ ("#dg_linkOrder"). DataGrid ("getchecked");
				if (Rows.length < 1) {$ (' #error '). Dialog (' Open '). Dialog (' Center '). Dialog (' Settitle ', ' false hint ');
			$ (' #error '). Text ("Please select a data");
				}else {for (var i = 0; i < rows.length; i++) {ordernoslist[i] = Rows[i].orderno;
								
				var params = {Reserveordernolist:ordernoslist}; $.ajax ({Url:api.
					Link_order_reserve_retry, data:JSON.stringify (params), type: ' POST ', ContentType: "Application/json",
						DataType: ' JSON ', success:function (res) {var str = ';
							$ (res.reserveflowlist). Each (function (i, obj) {var responsecode = Obj.responsecode;
							var orderNo = Obj.reserveFlow.orderNo;
							if (Responsecode = = 0) {str = = "Order number is" + OrderNo + "Success <br/>";
						
						else {str + = "Order Number" + OrderNo + obj.responsemsg + "<br/>"}}); $ (' #error2 '). Dialog (' Open '). DIalog (' Center '). Dialog (' Settitle ', ' hint ');
						$ (' #error2 '). html (str);
					Refresh list Linkorder.unfresh_linkorder ();
			}
				}); }

var demo = new Object ();
Demo.name= "1";
Demo.id= "2";
var demo2 = new Object ();
Demo2.name= "1";
Demo2.id= "2";

var conditons = [];
Conditons.push (demo);
Conditons.push (DEMO2);

$ (function () {
$.ajax ({
type: ' Post ',
URL: '/http/pss/demo ', 
		contentType: ' Application/json ', 
   data:{name: "123", Conditions:JSON.stringify (Conditons)},
dataType: ' JSON ', 
success:function (data    ) {
console.log (data);
},
error:function (XMLHttpRequest, Textstatus, Errorthrown) {
alert ("error");
}});




Java back end
	@RequestMapping ("/http/pss/reserveorderretry")
	@ResponseBody public
	Object Reserveorderretry (@ Requestparam ("Reserveordernolist") list<string> reserveordernolist) {return
		service.reserveorderretry ( reserveordernolist);
	}

	@RequestMapping ("/http/pss/reserveorderretry")
	@ResponseBody public
	Object Reserveorderretry (@ Requestparam ("conditions") list<demo> conditions,
							        @RequestParam ("name") String name) {
		
	}




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.