我已经阅读了有关此问题的所有问题,但没有设法解决它...
分数类:
public class Score
{
// default constructor
public Score()
{ }
public int TraitID { get; set; }
public double TraitScore { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
ASPX WebMethod:
[WebMethod]
public static bool Test(List<Score> scores)
{
return true;
}
Run Code Online (Sandbox Code Playgroud)
jQuery代码:
var scoresList = [{"TraitID":1,"TraitScore":2}, {"TraitID":2,"TraitScore":5}];
$.ajax({
type: "POST",
url: "Tryouts.aspx/Test",
data: "{'scores':" + JSON.stringify(scoresList) + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if (response.d == true) {
alert("success!!!!!");
}
else {
alert("problem!!!!!!!!!");
}
},
error: function …
Run Code Online (Sandbox Code Playgroud)