Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Verify using AJAX on page load

Posted on 2014-03-25
2
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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