Spent a solid hour trying to sort out why on earth this (coffeescript)
$.ajax
accepts: "application/json; charset=utf-8"
did absolutely nothing to change the accepts header, while this
$.ajax
dataType: "json"
properly sets the accepts header to application/json; charset=utf-8
Totally confused, am I missing something or is the accepts attrib a year-round April Fool's joke?
As always the documentation is your friend:
Now back to your problem. I am not familiar with cofeescript but contrary to
dataType
which is a string, theaccepts
parameter is a map and should be used like this: