ajax methods to get and post in the c # pass array

  1. post method
		 	var arr=["a","b"]
		    $.ajax({
		     		 type: "post",
		             url:  "../workgroup/GetMapListByView_Monitor_RealtimeInfoOfAll",
		             tanditional:true,
		             data:{arr:arr},
		             success: function(data) {
		                 console.log(data)
		             }
		     });
		     
		    [HttpPost]
		    public List<object> Get(string[] arr) {
		     
		    } 
  1. get method
	        $.ajax({
	         		 type: "get",
	                 url:  "../workgroup/GetMapListByView_Monitor_RealtimeInfoOfAll",
	                 tanditional:true,
	                 data:{arr:arr},
	                 success: function(data) {
	                     console.log(data)
	                 }
	         });
		         
			[HttpGet]
			public List<object> Get([FromUri]string[] arr) {
			 
			} 

Guess you like

Origin blog.csdn.net/qwe435541908/article/details/83088240