javascript - When sending jQuery post to MVC controller getting 404 error -
i'm sending view using jquery mvc post action
function dosomething(passedid) { $.ajax({ method: "post", datatype: 'text', url: '/mycontroller/someaction/', data: { id: passedid} }).done(function (data) { // }); } and inside mycontroller
[httppost] public actionresult someaction(int id) { ... } in firebug console i'm getting 404 error.
you didn't said version of jquery using. please check jquery version , in case version < 1.9.0 should instead of
method: "post" use
type: "post" this alias method, , according jquery official documentation should use type if you're using versions of jquery prior 1.9.0.
function dosomething(passedid) { $.ajax({ type: "post", datatype: 'text', url: '/mycontroller/someaction/', data: { id: passedid} }).done(function (data) { ... }); } tested above code , works (each request enter inside mvc controller http post someaction action).
Comments
Post a Comment