views:

62

answers:

1

Hi all,

i have a webmethod with the signature:

public string SubmitQAResults(int suppId, int result, int[][] qandAs)

I want to use jQuery to call this webmethod. What would it look like? thanks!

A: 

my advice is use plugin JSON.js ( http://devpro.it/code/149.html )

you can build your 2 dims array:

var players = new Array(
["TIME A",20],
["TIME B",25]
);

than convert to json and use as param

data:JSON.stringify(players);
Rbacarin
see more http://ajaxify.com/run/json/
Rbacarin
more help:http://msdn.microsoft.com/en-us/library/cc836459%28VS.85%29.aspx
Rbacarin
Hi thanks for the response! What might the ajax call look like?$.ajax({ type: "GET", url: "http://localhost:2968/MyService.asmx/SubmitQAResults", data: "{'players':'" + players + "'}", dataType: "jsonp", success: function(data) { alert(data.d); } });i am attempting to call an .asmx webservice..
bill
will look like this$.ajax({ type: "GET", url: "http://localhost:2968/MyService.asmx/SubmitQAResults", data: JSON.stringify(players), dataType: "json", success: function(data) { alert(data.d); } }); i'm not really sure if the JSON.stringify is inside the plugin JSON.js or native...
Rbacarin
ok cool.. so JSON.js is a jQuery plugin or some other "library"?
bill