ASP.NET MVC Ajax Call to controller method

In ASP.NET MVC .

$.ajax({
    type: ‘Get’, // Get or Postmethod
    url: ‘ControllerName/MethodName’, // ds is controller and getData is method
    data: { Parameter1: ‘12345’, Parameter2: ‘12345’ },
    async: false, // default its true
    dataType: “html”//xml, Json, HTML The type of data that you’re expecting back from the server
    success: function (signature) { //this is call back function
        if (signature != ){
            // do whatever you want
        }
    },
    error: function (xhr, ajaxOptions, thrownError) {
       alert(xhr.status);
       alert(thrownError);
    }
});
Advertisements
This entry was posted in Ajax, jQuery, MVC and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s