I’ve been playing more with Rails’ UJS via jQuery and I came across an error that took a while to track down. It turned out to be a content type problem.
Making the form was easy:
So was the Rails controller:
But Firebug kept showing the error “invalid label”. After much Googling and playing around with things I came to realize that there was one thing that was left out: the content type. Rails was returning the JSON as a string, not as a JSON data type. So a minor tweak to the controller solved everything: