如何将字符串数组从javascript传递到asp.net webservice?

时间:2016-03-22 21:16:32

标签: javascript asp.net web-services google-chrome-extension

我正在创建Google Chrome扩展项目。我有一个字符串数组,我想将此数组传递给我的Web服务并再次获取该数组。我怎样才能做到这一点?我是否需要一个数据库,或者我可以直接在它们之间进行通信?

function myFunction(selectedText) {

var selected = selectedText.selectionText;
var yenidizi = new Array();
var words = new Array(); // This is my array and I want to pass this array to my web service.

for (var i = 0; i < words.length; i++)
{

    for (var j = 0; j < words[i].length; j++)
    {
            var newstring = words[i];
                var temp = null;
                words[i] = temp;
                temp = newstring;
                words[i] = temp;
                newstring = null;
        }
}

}

1 个答案:

答案 0 :(得分:0)

建议您查看Getting Started AJAX,代码类似于以下内容

var yourArray = [,];
$.post(url, { data: yourArray}, function (response) {
    // your callback here
}, "text");