I have a jquery file from which I'd like to call a view. The action at the controller is called Inbox. What is the right way to call this action from the jquery file?
+2
A:
Your question is very vague and strangely formulated, but i suppose you're looking for jquery assistance.
jQuery offers many ways to do an ajax call. The easiest one is load() $('#container').load('path/to/file.html');
pixeline
2010-08-02 16:44:04
I was trying doing it this way but the code is incorrect:$.ajax({ type: "get", url: "planning/inbox", data: "s.Site="+SearchSite+"
Hallaghan
2010-08-02 16:52:44
@Hallaghan -- you should be careful of the extra trailing comma there, and add a call for success and error handling. [This question](http://stackoverflow.com/questions/377644/jquery-ajax-error-handling-show-custom-exception-messages) should get you on your way, as you can see how they've handled this.
Joshua Cody
2010-08-02 17:38:28
A:
when calling an ajax, your data must be a json object
$.ajax({
type: "get",
url: "planning/inbox",
data: { s.Site: searchSite, s.Date: SearchDate }
})
GerManson
2010-08-02 17:16:41
Eh, not so fast. Per [the .ajax documentation](http://api.jquery.com/jQuery.ajax/), your dataType can be JSON, XML, a script, or HTML.
Joshua Cody
2010-08-02 17:32:49
I called the page this way now:var SearchDate = $('#s_Date').val(); var SearchSite = $('#s_Site').val(); $('#inbox').load('planning/Inbox?s.Site=' + SearchSite + 'But it takes a long time to retrieve the view like this.
Hallaghan
2010-08-02 17:35:00