I have the following jquery function that submits to an iframe. The message sent back from PHP is json. I can’t figure out how can I receive this message in jquery so I can display it to the user.
function IframeSubmit(){
// remove iframe if exists
$('#hiddenIframe').remove();
// change target attribute on form
form.attr('target', 'hiddenIframe');
// create and add iframe to page
$('<iframe />', {
name: 'hiddenIframe',
id: 'hiddenIframe',
style: 'display:none'
}).appendTo('body');
// on response from php file
$('#hiddenIframe').load(function(){
// process received message here ...
});
}
Thank you!
I have a similar code:
the output in iframe is:
read response like: txt.error or txt.message
PHP part: