New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the data argument to be a string #26
Comments
Something like this should be used in case someone else is trying to get around this issue: https://github.com/danheberden/jquery-serializeForm |
Edit - $('form').on('submit', function() {
var obj = $(this).serializeJSON(); //using aforementioned plugin
client.api.foo.update(obj).done(...);
return false;
}); |
Did you try your example? It definitely doesn't work, which is why I opened this issue. As I said, And yes, as I mentioned, there are plenty of plugins to help with this, some of which are here in this list. But the user has to realize they need this. I spent a considerable amount of time today trying to figure out what wasn't working, as sending form data is a core use case for ajax integration. I eventually figured it out by stepping through the source code (which was more difficult than it needed to be due to the overly-verbose coffeescript generated output). Anyway, at the very least, please document this limitation. |
Ah yep misread your initial comment, my mistake. create - Only Only thing is I don't have time to make this change, so I'll reopen and mark for PR :) Also see #27 |
Since data must be passed as an object, there is no easy way to get form data and pass it into the ajax request (say on a form submission, with data using jQuery.serialize()). The magic arguments parsing in
Resource.prototype.extractUrlData
seems to make this impossible to fix.Anyway, I'm not sure how to get around this, but form submission seems like a fairly common rest api necessity.
The text was updated successfully, but these errors were encountered: