Closed JeanMertz closed 12 years ago
these types of errors are almost always jquery trying to parse the content as a different content type than what it is getting (or thinks it's getting). can you provide the jquery ajax error message? it's in the object reference in the last line of your issue. https://github.com/jejacks0n/mercury/blob/master/vendor/assets/javascripts/mercury/page_editor.js.coffee#L217
You are correct. The problem was that I use the (deprecated?) mercury_loader.js
to load Mercury in the current URL without prepending /editor
or anything. The way I loaded this was through
javascript_include_tag "mercury_loader.js?saveStyle=form&saveDataType=script"
This worked pre Rails 3.1.x but after upgrading RailsI started to get the above error. Turns out Sprockets now appends .js
to that line, resulting in a saveDataType
of script.js
which jQuery obviously doesn't understand.
Appending a quick &
to the end of the above line fixed the problem for me. Thanks for the help.
Not sure if the loader is deprecated. I know it has a lot of issues. I personally don't use it.
This seems related to #155 but somehow I cannot get the proposed solution in that thread to work for me.
Here is how I respond to the POST request from Mercury:
The last line, the rendering part, is what was advised in that thread. However, Mercury still says something went wrong, even though the record(s) got updated and the response code clearly shows 200 OK.
Other things I tried:
Everything I try results in the same (expected) response:
But still, the popup shows up alerting me that something went wrong. (also the debugger indeed shows
["save_failed", Object]
)