Monday, 18 March 2013

How to make Ajax call with post parameters

first include any jquery min file in your page and then on document.ready function or on any function of javascript you can make a ajax call like below. i am writing it on document.ready event.

$(document).ready(function () {
        type: "POST",
        url: "HandleWebRequests.aspx", //here you can use handler also ...
        data: "{}",
        success: function (response) {
        error: function (response) {
            \\write code if error is returned.     
and you can access these parameters on page or handler using request.form element.
like as below. i am accessing these parameters on aspx page using c#.

 string name = Convert.ToString(Request.Form["name"]);
 string email= Convert.ToString(Request.Form["email"]);