Ruby on Rails Tuesday, January 4, 2011

I found the answer (at least for me)!

The issue is described here:

https://github.com/rails/jquery-ujs/issues/issue/52

More info here on the official fix:

https://github.com/rails/jquery-ujs/commit/fbbefa0773d791d3a67b7a3bb971c10ca750131b

The solution was to add a line of jQuery to set the proper request
header to handle Ajax calls. In my
app/views/layouts/application.html.erb, just add this after you include
the jQuery file:

<script type="text/javascript">
jQuery.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "text/javascript");
}
});
</script>

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment