Colorbox - how to set data property to use POST instead of GET
I'm using the colorbox plugin and according to the docs, the data
property allows submitting GET or POST values through an ajax request. I can submit my data via GET no problem, but can't figure out how to switch to POST. I'm using serialize to set the form data in name/value pairs. I have the code below:
Is there a way to set this to POST?
var data = $('form').serialize();
console.log(data);
// Preview newsletter - bind colorbox to event
$('a#preview').colorbox({
width: '670px',
href: $(this).attr('href'),
data: data
});
return false;
});
Use
$('form').serializeArray();
The data property will act exactly like jQuery's .load() data argument, as ColorBox uses .load() for ajax handling.
精彩评论