tags:

views:

20

answers:

2

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
I was trying doing it this way but the code is incorrect:$.ajax({ type: "get", url: "planning/inbox", data: "s.Site="+SearchSite+"
Hallaghan
@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
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
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
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