私は2つのjavascript文字列配列 "myArray1"と "myArray2"をajaxからwebmethodに渡したいと思います。私が持っているものは次のもので、うまくいかないものです。複数の配列を渡します。 ajax to webmethod
var myArray1 = new Array();
var myArray2 = new Array();
// the arrays are filled further in the code.
// call to the webmethod:
$.ajax({
type: "POST",
url: "mypage.aspx/SavePage",
data: ??????,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg.d);
},
error: function() {
alert("failed");
}
});
私はこれらの配列をdata:
コールの一部に渡す方法がわかりません。
C#コードの一部です。
public static string SavePage(List<string> myArray1, List<string> myArray2)
{
}
このhttp://www.aspsnippets.com/Articlesを見てください/Send-and-Receive-JSON-objects-to-Web-Service-Methods-using-jQuery-AJAX-in-ASPNet.aspx – coder