I have solved this by navigating the colorbox to about:blank, and then, in the onComplete callback, rendering a form with hidden fields, that is submitted with POST data. Working perfectly for this purpose.
function createFormInputsFromObject(data, prefix) {
prefix = prefix || '';
var inputs = '';
jQuery.each(data, function(name, value){
if (prefix !== '') name = prefix + '[' + name + ']';
if (Array.isArray(value) || value instanceof Object) {
inputs += createFormInputsFromObject(value, name);
}
else {
inputs += jQuery('<input>').attr({type: 'hidden', name: name, value: value}).prop('outerHTML');
}
});
return inputs;
}
function showPdf(url, postData) {
jQuery.colorbox({
iframe: true,
href: 'about:blank',
width: '90%',
height: '90%',
onComplete: function() {
var iframe = jQuery('#cboxLoadedContent iframe');
var form = jQuery('<form>').attr({action: url, method: 'POST', target: iframe.attr('name')});
if (!jQuery.isEmptyObject(postData)) {
jQuery(createFormInputsFromObject(postData)).appendTo(form);
}
form.appendTo(iframe)
.submit()
.remove();
}
});
}
showPdf('/source/url', {sitName: 'sitka', items: [2, 4, 5, 6], extended: {i1: [10, 20], i2: {a: 0, b:1}}});