can you return a string[] from ASMX to JQuery AJAX?
Here's my web method
[WebMethod(EnableSession = true)]
public string[] LoadArray()
Here's my javascript
$.ajax({
type: 'POST',
url: '/services/Service.asmx/LoadArray',
data: "{}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(arr) {
for (v开发者_高级运维ar i = 0; i <= arr.length; i++) {
addNewPatient(arr[i]);
}
}
});
I tend to have my function return a string, and put the array of strings into one json result to pass back to the client.
Have you tried to do this?
What was the error message?
i fixed the problem
the array should be "arr.d"
精彩评论