Click here to Skip to main content
16,018,418 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi
I have logout.aspx page in which when someone clicks the logout then it will check in database whether time is entered by the user and if not it will throw an error.

I want sql query for this using javascript.

can somebody help me in this.
Posted

1 solution

Hi you can not call sql query from javascript..You can do this by calling web method from Jquery Ajax and get response from that.

for example,
JavaScript
$.ajax({
      type: "POST",
      url: "WebService.aspx/CheckLogout",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
        // Replace the div's content with the page method's return.
        alert(msg.d);
      }
    });

Create a CheckLogout web method in WebService.aspx page and return result
C#
[System.Web.Services.WebMethod]
public static String CheckLogout()
{
   // return result
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900