I created a small JQuery Plugin and I'm using thickbox for popups.
I don't know where it came from but I have a "0" appended to the end of the body
element.
I suspect that one of those outputs a success indicator maybe?
Is anyone familiar with this behavior?
Edit:
PHP
add_action('wp_ajax_product_picker', 'popup_content');
function popup_content() {
iframe_header();
echo 'aaa';
iframe_footer();
}
JS
var currentPicker = {};
(function ($) {
$.fn.pick_product = function (options) {
var settings = $.extend({
callback: function(){}
}, options);
this.on('click',function () {
var url = product_picker.ajax_url + "?action=product_picker&TB_iframe=true&width=600&height=550";
tb_show("My Caption", url);
});
return this;
};
}(jQuery));
jQuery(function ($) {
$('#test-product-picker').pick_product({
callback: function (variation_id, size) {
alert('aaa');
}
});
});
If you are using it on the front end of your site you have to use the
wp_ajax_nopriv_product_picker
and also place die()
after your function.
function popup_content() {
iframe_header();
echo 'aaa';
iframe_footer();
die();
}