Click here to Skip to main content
12,359,751 members (65,289 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: MVC
Hi,

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

Thanks & Regards,
Soumya
Posted 8-Oct-12 23:28pm
soumyaraj1.3K
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100