So I had some issues with an App I’m doing, I was calling an entire template…
The problem was that when you call a template, you load all the libraries with it… its just crap.
So I create a partial to just call the partial for every search, without the libraries or anything that I don’t need.
To do that you must specify the partial in the respond_to like this
respond_to do |format|
format.html { render :partial => 'partials/results' } # index.html.erb
format.json { render json: @results, :callback => params[:callback] }
end
And with jquery you just call the data
$.get "/search/result", data, (data) ->
$("#resultados").html data
Maybe some of you already know that, but I’m just letting this here so maybe it can be helpful to someone else.