Click here to Skip to main content
15,893,790 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to create an MVC application with HttpGet and HttpPost methods using jquery
Pls help me

Thanks & Regards,
Soumya
Posted
Comments
vyas_pratik20 9-Oct-12 5:34am    
be clear MVC is .net MVC ?
you want to create or call the action from jquery
soumyaraj 9-Oct-12 5:56am    
yes .net MVC

I want to call the action from jquery

1 solution

Use something like:

$.ajax({
           type: "POST",
           url: url,
           contentType: 'application/json; charset=utf-8',
           data: postData,
           dataType: "json",
           success: function (result) {

               if (redirectOnError("json", result)) {
                   return;
               }

               SuccessFunction(result);
           },
           error: errorHandler


URL s'd be the form of "http://baseurl/controller/action". So make sure you have both defined.

For 'Get' request just change
type: "GET"
And also you have to pass parameters attached in query string.
 
Share this answer
 
v4

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