asp.net mvc jQuery $.post works but $.get doesn't

Posted by iboeno on Stack Overflow See other posts from Stack Overflow or by iboeno
Published on 2010-04-23T19:32:02Z Indexed on 2010/04/23 19:33 UTC
Read the original article Hit count: 189

Filed under:
|
|
|
|

Why would POST work but not GET? I'm not using [AcceptVerbs(HttpVerbs.Post)]. I'm calling this:

public ActionResult GetTest(string key)
        {
            var test = new { HelpTest = key };
            return Json(test);
        }

And it works when I do this:

$.post("/Home/GetTest", { key: options.key },
                        function(helpTest) {
                            alert(helpTest.HelpTest);
                        });  

But not this:

$.get("/Home/GetTest", { key: options.key },
                            function(helpTest) {
                                alert(helpTest.HelpTest);
                            });  

Why would this be? Using GET returns an XMLHttpRequest.status of 500. What am I confused about?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc