Jquery post array via ajax
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-04-22T02:15:17Z
Indexed on
2010/04/22
2:23 UTC
Read the original article
Hit count: 297
I have an array (for checkboxes) that I need to pass alongside the regular form in an ajax post, but can't seem to get this to work:
new_data = [a,b,c,d,e];
somedata_assoc = JQuery.param({'choices[]': new_data});
$.ajax({
type: "POST",
url: contract_qurl,
data: $(div).find("form").serialize()+"&"+somedata_assoc,
context: $(this),
success: function(data) { $("#results_table").html(data); }
});
© Stack Overflow or respective owner