Hi,
I am using JQuery in my rails app. I've taken the approach outlined in Ryan Bates's Railscast on jquery to do the following:
jQuery.ajaxSetup({ 'beforeSend' : function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} });
to set my ajax call request Headers to text/javascript so that my respond to block for javascript is invoked.
This works great up until I get to wanting to call jQuery.getJSON
It appears that my ajaxSetup call causes the getJSON call to send the text/javascript header instead of application/json.
Now there are a number of ways I can work around this (using jQuery.ajax, not using ajaxSetup ...)
But I was wondering if there is a convention that folks have adopted in cases like this?
Thanks! Jay