i have following script
Parent Page(pair_pixel_filter.php):
window.addEventListener("message", function(e) {
$('#log').append("Received message: " + (e.data));
}, false);
$('.photo-upload-btn').click(function(event) {
event.preventDefault();
window.open($(this).attr("href"), "popupWindow", "width=600,height=600,scrollbars=yes");
});
The Child Page
$.ajax({
type: 'post',
url: url,
data: {
base64data: dataURL
},
success: function(data) {
window.opener.postMessage(data, "pair_pixel_filter.php");
window.close(); }
});
Basically opening a Popup and then doing some ajax on pop up and returning result to parent. But from Child i am getting this error.
Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin 'pair_pixel_filter.php' in a call to 'postMessage'