Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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."


This 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?


Sorry, I was talking about the default accepts header for jQuery AJAX requests.


I guess this makes sense if you're standardized on JSON (as opposed to say XML or HTML) responses.


Keep 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: