Hi,
I am rather rubbish when it comes to AJAX and javascript on general.
I have a WebMethod:
[System.Web.Services.WebMethod] public static string DumpClients() {}
I have this code in a js file:
mainScreen.DumpClients = function() {
$('#runclientdumpbtn').attr("disabled", "true");
mainScreen.clientDiv.innerHTML = "";
$("#loadingimageclientdump").show();
PageMethods.DumpClients(mainScreen.DumpClientsCallback, mainScreen.DumpClientsFailed);
}
mainScreen.DumpClientsCallback = function(result) {
if (result) {
$("#loadingimageclientdump").hide();
mainScreen.clientDiv.innerHTML = result;
$('#runclientdumpbtn').removeAttr("disabled");
}
};
mainScreen.DumpClientsFailed = function(error, userContext, methodName) {
if (error) {
// TODO: add your error handling
$("#loadingimageclientdump").hide();
mainScreen.clientDiv.innerHTML = error.get_message();
$('#runclientdumpbtn').removeAttr("disabled");
}
};
Sys.Application.add_load(applicationLoadHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler);
This worked fine, (I admit I do not fully understand this at all), until I needed to access a dropdownlist from the page. As it is a static method I can not directly get it, so I thought I could pass the value back through the webmethod.
The small problem is I have no idea how. I have been Googling it but am not getting anywhere fast. I am working my way through a JQuery book and understanding more of the basics but this is way beyond me at this moment.
I appreciate any and all help and advice, and sorry that I am probably asking a bit of a stupid question.
Thanks