Click here to Skip to main content
Rate this: bad
good
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 9-Oct-12 0:28am
soumyaraj1.2K
Comments
vyas_pratik20 at 9-Oct-12 5:34am
   
be clear MVC is .net MVC ?
you want to create or call the action from jquery
soumyaraj at 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
0 OriginalGriff 213
1 ProgramFOX 205
2 Sergey Alexandrovich Kryukov 158
3 Peter Leow 140
4 Dave Kreskowiak 101
0 OriginalGriff 288
1 ProgramFOX 165
2 Peter Leow 130
3 Sergey Alexandrovich Kryukov 95
4 Fredrik Bornander 85


Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2015
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