Rails JSON callback - Sphinx

Im using thinking sphinx and it has become necessary to pull out the search results as JSON array with callback (JSONP). In my other functions like show, adding .json?callback=asd to the url allows this. But not for what i have retrieved with thinking_sphinx. This is what my index looks like

def index
  @profiles = Profile.search params[:search], :match_mode => :any
  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @profiles, :callback => params[:callback] }

Ive been able to say /profiles.json?search=what to get a json. But how do i get a callback What kind of url do i need to send, or other change i need to make, to get the right format for my models -- wrapperFunction(arrayOfJSONs)


Just add the callback as another query parameter:


Just substitute <query> and <callbackname> with your values.

Need Your Help

ITextSharp - using PdfStamper resulting MemoryStream to close

c# pdf itextsharp memorystream

I'm using ITextSharp to split multi-page PDF files into single page files. I also managed to add those single page PDFs to a zip file using MemoryStream.

Spring Autowiring a property within an autowired bean

java spring spring-boot

I'm a newbie to Spring. I'm facing a problem with Spring-Boot. I'm trying to autowire a field from an external config file into an autowired bean. I have the following classes