this type has two questions that are difficult to explain, but I will give it to him.
I have a form that uses the target attribute to target the iframe when the form is sent to posts that are sent to a PHP script. This part works fine, but I need to do something based on several results that the PHP script will put in the iframe.
What I'm going to do is when the PHP script finished echoing it from some hidden input fields that contain various elements, such as the status of the message, whether it was completed and what the end result is if it was successfully published.
However, if I did this, it would put it in an iframe, so the main web page will not be able to access the hidden input fields.
How would the main web page be able to access these hidden input fields so that the main web page can perform some kind of action, Ie make a div on the web page, show a specific error message or something else.
Another thing is when I know how I can get data from a hidden input field, how do I know when I can go and get values. I thought that when a form is submitted via javascript code document.forms ["myform"]. Submit (), I could do a while loop and check if it is established that another status of the hidden input field is completed, and when it says Finally, I can get the values ββfrom the hidden input field.
I'm not sure the way I suggested is the right way or doing what I want to achieve, or if there is a better way to do this, but any help would be greatly appreciated.
thanks
UPDATE
I tried what @lanzz suggested, but it didn't seem to work. Below I have tried.
$("iframe#image_upload_frame").on('load', function() { var iframeBody = this.contentDocument.body; var data = $(iframeBody).find("#imageDirectory"); alert("data: " + data); });
The following shows how the iframe is defined.
<iframe id="image_upload_frame" name="image_upload_frame"></iframe>
and I repeat the hidden input field in the php script that is inside the iframe.
echo '<input type="hidden" id="imageDirectory" value="'.$imageDirectory.'" />';
The echo definitely works as when I see the iframe source view, I can see the hidden input, however the warning dialog never appears as if something is not working. Error messages are not reported by the Google Chrome Chrome console.