question, statement or are you just giving us your current status?? :) the way that I have generally done something like this is to call some
[WebMethod]
either in a web service or a page method. technically those
public static
page methods are nothing but web service methods. at least in my opinion they are.
[WebMethod]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)]
public DataTable someMethod(string param)
{
DataSet dsReturn;
try
{
// do your database stuff
// I like to name the table so that it makes parsing it in jQuery easier for me
dsReturn.Tables\[0\].TableName = "someName";
}
catch (Exception)
{
// do your error handling
throw;
}
return dsReturn.Tables\[0\];
}
then my jQuery code I use the
$.ajax(...)
function to call the web service.
$.ajax({
type: 'POST',
url: 'location/name.asmx/someMethod',
data: "{ 'param': 'paramValue' }",
contentType: 'application/json; charset=utf-8',
dataType: 'xml',
success: function (xml) {
// parse and loop through the records in the datatable
$('someName', xml).each(function() {
// your this pointer actually is a record in your datable
$(this).find('ColumnName').text();
});
},
error: function(err) {
// do your jQuery error handling here
}
});