ajax - jQuery Form Plugin posting array as string -
i using jquery form plugin (http://malsup.com/jquery/form/) , trying post array php file processed, can't work intended.
with regular jquery $.ajax
code example:
var = [1,2,3]; $.ajax({ url: "uploader.php", type: "post", data: ({ a: }) });
would output php variable $_post['a']
as
array ( [0] => 1 [1] => 2 [2] => 3 )
with plugin output of $_post['a']
string equals "1,2,3".
i want plugin act $.ajax
does.
would handy see code sets jquery form plugin, if you're doing drop-in replacement assume like:
$('#myformid').ajaxform({ url: uploader.php, type: "post", data:({ a:a }) });
without checking i've assumed "data" gets merged form data jquery form plugin
i'm guessing ajax form plugin calls tostring javascript method on a
- give "1,2,3"
to json string json.stringify(a). ie:
$('#myformid').ajaxform({ url: uploader.php, type: "post", data:({ a:json.stringify(a) }) });
not sure work - worth try
Comments
Post a Comment