Friday, December 27, 2013

Jquery Ajax Call in Asp.Net

 <div id="Result">Click here</div>
<script type="text/javascript">
    $('#Result').click(function() {
      $.ajax({
        type: "POST",
        url: "Default.aspx/HelloWorld",
        data: "{}",
        contentType: "application/json",
        dataType: "json",
        success: function(msg) {
          // Replace the div's content with the page method's return.
          $("#Result").text(msg.d);
        }
      });
    });
  </script>

No comments:

Post a Comment