你怎么传递到通过jQuery Web服务的数组的String []? [英] how do you pass an array string[] to a Web Service via Jquery?
本文介绍了你怎么传递到通过jQuery Web服务的数组的String []?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的代码:
VAR的id = $ .MAP($(#集装箱-1),儿童( ),功能(N,I){
返回n.id;
});
$阿贾克斯({
型:POST,
网址:'Loader.asmx /主动',
数据:{'的div':' + IDS +'},
的contentType:应用/ JSON的;字符集= utf-8',
数据类型:'JSON',
成功:函数(MSG){}
});
解决方案
的Javascript;
VAR IDS = $ .MAP($(#集装箱-1)。儿童()函数(N,I){
返回否。 ID;
});
$阿贾克斯({
型:POST,
网址:'Loader.asmx /主动',
数据:{div的:ids.join( |)}
的contentType:应用/ JSON的;字符集= utf-8',
数据类型:'JSON',
成功:函数(MSG){}
});
在C#中:
的String [] = arrIds divs.Split('|');
here's my code:
var ids = $.map($("#container-1").children(), function(n, i) {
return n.id;
});
$.ajax({
type: 'POST',
url: 'Loader.asmx/Active',
data: "{'divs':'" + ids + "'}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(msg) {}
});
解决方案
Javascript;
var ids = $.map($("#container-1").children(), function(n, i) {
return n.id;
});
$.ajax({
type: 'POST',
url: 'Loader.asmx/Active',
data: { divs: ids.join("|") },
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(msg) {}
});
in C#:
string[] arrIds = divs.Split('|');
这篇关于你怎么传递到通过jQuery Web服务的数组的String []?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文