I'm curious as to why with this ajax call:
$.ajax({
dataType: 'jsonp',
type: 'GET',
url: 'http://localhost:3000/gwsearch/ajax_search?d1=36354&d2=36355',
crossDomain: true
}).done(function(data){
alert(data);
});
To this rails method:
def ajax_search
#random code
respond_to do |format|
format.html
format.js { render :json => @gw_search_results.to_json, :callback => params['callback'] }
end
I am getting an html response. If I remove the "format.html" I get a jsonp response back with the correct data, but I am just curious as to why rails is choosing to send back html by default, instead of jsonp? What am I missing? I thought with a js call, it shoots back a js response if available?