Page 1 of 1

Iframe in javascript variable with data from php

Posted: 04 Oct 2017, 11:53
by JanMolendijk
Dear Admin i Hope you understand my Question
I would like to use your SimpleModal Windows script
But into my notice-script the code where i wanna add the SimpleModal
starts like this

Code: Select all

  $rehtm .='
I can`t add --> ' <-- anymore i need to change the whole code with " but...
then My IFRAME is not shown into the modal

Code: Select all

// content
var win_cnt = " <iframe src="All-Notice.php" 
width="300" height="440" frameborder="0" scrolling="yes" 
align="top" marginwidth="0" marginheight="0" name="offtopic">

</iframe>";

// Calls modalW1(), passing win_cnt, on click the button
$("#basic-modal .button").click(function (e) {
 modalW1(win_cnt);
 return false;
});
</script>
Edit:
After long trying I found a way to do it, but now it does not detect: $row['notice_id']
i trying many differents for detection but without any success.

Code: Select all

// content
var win_cnt = " <iframe src=/comments/user/User-Info/Notice-Plus.php?notice_id='. $row['notice_id'] .'</iframe>";

Iframe in javascript variable with data from php

Posted: 04 Oct 2017, 15:03
by Admin
The content you want to show in <iframe> must be defined in the page from the "src" address of that iframe.
To add your <iframe> in a php page, into a javascript variable, try this code in the js <script>:

Code: Select all

var win_cnt ='<iframe src="/comments/user/User-Info/Notice-Plus.php?notice_id='+<?php echo $row['notice_id']; ?> +'"></iframe>';

Iframe in javascript variable with data from php

Posted: 04 Oct 2017, 22:00
by JanMolendijk
Dear Admin i just found they answer
I have to put '. $row['notice_id'] .' to the basic-modal, button & win_cnt...

All things are working corectly now.
Thanks for the support