I have the following JSON call, the data I'm passing seems to be getting stringify'ed properly from what i'm looking at, however, I don't seem to have the right syntax to process the parameter in the public web method.
Here is the JSON call:
<script type="text/javascript" language="javascript">
var qs = new Querystring();
var v1 = qs.get("TorVName");
var jsonData = JSON.stringify(v1);
$().ready(function() {
$.ajax({
type: "POST",
url: "Default.aspx/GetColumns",
data: jsonData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
var optString = '<option value="-1">Select Column</option>';
$.each(msg.d, function(index, item) {
optString += '<option value="' + item + '">' + item + '</option>';
});
$('select[name^=DDLColumns]').html(optString);
},
error: function() {
alert("Failed to load columns");
}
});
});
</script>
and here is the cooresponding web method:
[WebMethod]
public static ArrayList GetColumns(string TorVName)
{
String cnstr = "myconnect string";
string Sql = String.Empty;
ArrayList arlist = new ArrayList();
SqlDataReader rdr = null;
SqlCommand cmd = null;
DataSet dset;
SqlConnection cn = new SqlConnection(cnstr);
cn.Open();
dset = new DataSet("ds");
dset.Clear();
etc etc...
I have a hard time deciding how to debug a web method since I can only see the client side actions in firebug.
any help on how to recieve and process the parameter in the web method would be most appreciated.
Thanks Deano