0
    [HttpPost]
    public ActionResult accountchange(int id, int accountid, bool activate)
    {
        // Operations
        return Json(new { Model = model, Result = true, Message = "Changed Successfully });
    }

    $('#accountchange-button').click(function () {
        alert("");
        $.post("url/accountchange/", {id:1, accountid:1, activate:1},
            function (data) { $('.result').html(data); }, "json");

    });

always got:

POST http://localhost/account/accountchange/ 500 (Internal Server Error)
                f.support.ajax.f.ajaxTransport.sendjquery.min.js:4
                f.extend.ajaxjquery.min.js:4
                f.each.f.(anonymous function)jquery.min.js:4
                (anonymous function)demo:105
                f.event.dispatchjquery.min.js:3
                f.event.add.h.handle.i

any idea?

3
  • You should be to see the full the XMLHttpRequest's response within Chrome developer tools or Firebug. The response from your server will have more information than just an HTTP status code. Commented May 4, 2012 at 22:28
  • 500 is an internal server error - what do your server error logs say? Commented May 4, 2012 at 22:40
  • thanks jaredhoyt, i will debug with firebug Commented May 4, 2012 at 22:41

2 Answers 2

1

In your code, I don't see model being defined. That's my best guess as to why your application is returning a 500 application error. As previously mentioned in the comment, you can use the inspect element utility to figure out what the server is actually complaining about.

[HttpPost]
public ActionResult accountchange(int id, int accountid, bool activate)
{
    // Model = model is most likely undefined
    return Json(new { Model = model, Result = true, Message = "Changed Successfully });
}
Sign up to request clarification or add additional context in comments.

Comments

0

Have you set up your routing in Global.asax to accept the 3 parameters you are passing?

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}/{accountId}/{activate}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional, accountId = UrlParameter.Optional, activate = UrlParameter.Optional } 
        );

1 Comment

i dont use model MattSavage in this action

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.