Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Web Method in AJAX

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 37
    Comment on it

    For sending and retrieving data through AJAX calls can be done with the help of web method .


    We first create a web method that needs to be invoked when event is fired.


    This will be the code behind page :


     [WebMethod]
      public static string GetDate()
      {
        return DateTime.Now.ToString();
      }
    


    We will create a JS file from which call will be made:


    $.ajax({
      type: "POST",
      url: "PageName.aspx/GetDate",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(msg) {
       $("#divmain").html=msg;
      }
    });
    
    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: