views:

72

answers:

2

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 (var i = 0; i <= arr.length; i++) {
                addNewPatient(arr[i]);
            }
        }
    });
+1  A: 

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?

James Black
A: 

i fixed the problem

the array should be "arr.d"

Martin Ongtangco