views:

318

answers:

2

I am working on a ASP .NET MVC2 project where i have to load data using $.get() but it doesn't works. Although if i call same method with $.post() even giving [AcceptVerbs(HttpVerbs.Post)] above of my controller method or not it works. So i just want to ask Does Microsft has put a restriction inn calling $.get() with ASP .NET MVC2. If yes then whats the reason behind it security or anything else.

A: 

What do you mean it doesn't work? What http status code do you get? Is there an error message? Try using firebug and open the net tab to watch the result to see any errors and to also make sure it is calling the url you are expecting. Also, have you tried using jQuery $.ajax() instead of $.get()?

thekaido
doesn't work means method can't be called with get request.
deepesh khatri
A: 

Are you using .Net Framework 3.5 ? Maybe you should consider creating an Ajax enabled WCF service, the asp postback and autopostback model can be the reason why it doesn't work nicely .

Firebug / fiddler is your friend

Darkyo
Uff this sounds utterly complicated for a simple GET request! I've been working with AJAX for some time now, and I have never ever used WCF.
mnemosyn
I thought too, but a MVP told me the old way (using EnablePageMethod trick and [WebMethod] tag) is deprecied !
Darkyo
Aren't `EnablePageMethod` and `[WebMethod]` related to plain ASP, i.e. w/o MVC? I've never heard of these in an MVC context and it doesn't seem to make sense. MVC's controllers are made of actions and these can be called from the net per defition.
mnemosyn