I want to be able to pass all of an element's data
attributes, without have to individually specify them. For example:
function foo(elem) {
$.ajax({
type: 'POST',
data: JSON.stringify(elem.data()),
...
However, when I simply supply elem.data()
, nothing is actually getting passed. Is there a way to accomplish this without having to individually specify, like:
data: JSON.stringify({ foo: elem.data('foo'), ... })