chinoknot Posted January 26, 2016 Share Posted January 26, 2016 Hello, I need your help. I wrote about this thing two months ago, but without useful answer, now I need to complete this work. I understood better how it works, but I need the last thing. I try to explain my problem: I need to receive a "post" from another domain, but I can't understand how can I do this, because the sender send me a json and I need to get in my receiver. This is my code:<script>//create popup windowvar domain = 'http://10.5.15.145';var myPopup = window.open(domain + '/Apps/post/child_backup.php','myWindow//periodical message sendersetTimeout(function(){var message = JSON.stringify({action: "redirect", vendor_id :"45" });console.log('blog.localending message: ' + message);myPopup.postMessage(message,domain); //send the message and target URI},1000);//listen to holla backwindow.addEventListener('message',function(event) {if(event.origin !== 'http://10.5.15.145') return; console.log('receivedponse: ',event.data);},false);</script>Now the vendor_id is "45" for a test. They pass to me vendor_id: xxxx. how can I grab this value from the post?Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/300665-postmessage-receiver-how-to-retrieve-the-postmessage/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.