Verify using AJAX on page load

Hi all,

I have a verify.aspx page.

I would like to load the page initially, then use ajax and a web method to run a some db function.

Does anyone have any ideas how I would load the page initally and then trigger the ajax call once the page has loaded?
flynnyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
Using PageMethod it's easy :

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.enablepagemethods(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/bb398998(v=vs.110).aspx/#code-snippet-7

[System.Web.Services.WebMethod]        
public static string RunDBFunction()
{
      // DO YOUR DB STUFF
}

Open in new window


window.onload = function() {
      PageMethods.RunDBFunction(onSucceed, onError);
}
function onSucceed(result) {
      alert(result);
}
function onError(result) {      
}

Open in new window

0
 
Johny BravoCommented:
I would go for master page instead and make a call to the webservice from jquery on master page.
0
All Courses

From novice to tech pro — start learning today.