Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Verify using AJAX on page load

Posted on 2014-03-25
2
Medium Priority
?
356 Views
Last Modified: 2014-03-31
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?
0
Comment
Question by:flynny
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39954640
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
 
LVL 8

Expert Comment

by:johny_bravo1
ID: 39965108
I would go for master page instead and make a call to the webservice from jquery on master page.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question