$.ajax({
url: '/create_lead',
data: {
name: $('#lead_gen_name').val(),
lead_gen[email]: $('#lead_gen_email').val(),
},
type: 'POST',
dataType: 'json',
success: function(data) {
}
});
I would like to use the jQuery Post method to post a hash of information. I would like it to post in this format lead_gen[email], lead_gen[address] and so on…
How does one format the Post method to do this. The above code fails with a syntax error.
It looks to me like it should work, but for the fact that lead_gen[email]: won’t work as a key the way you have it here. Put quotes around it.