4 ms·
If anyone is curious, the default accepts header in jQuery is */* which means, "give me whatever you have." This will actually cause Rails to respond wit
by JangoSteve 16y ago
If anyone is curious, the default accepts header in jQuery is
*/*
which means, "give me whatever you have." This will actually cause Rails to respond with whatever the first format is that you happen to have defined with your respond_to or respond_with method in your controller.
This isn't very intuitive, which is why we made the jquery-ujs set the default accepts header for remote requests to
*/*;q=0.5,text/script
which says, "give me whatever you have but I prefer JavaScript if you have it."
- euroclydon 16y agoThis isn't clear. Are you talking about the default accepts header in a jQuery AJAX request or in some jQuery script loader script that rails uses to load the jQuery library?
- JangoSteve 16y agoSorry, I was talking about the default accepts header for jQuery AJAX requests.
- r00fus 16y agoI guess this makes sense if you're standardized on JSON (as opposed to say XML or HTML) responses.
- JangoSteve 16y agoKeep in mind that you can specify whatever data type you want with jQuery. The default I speak of is just for when you don't specify any data type.