Iframe in javascript variable with data from php

Topics related to client-side programming language.
Post questions and answers about JavaScript, Ajax, or jQuery codes and scripts.
User avatar
JanMolendijk
Posts: 144
Location: Holland Rotterdam

Iframe in javascript variable with data from php

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>";

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>';

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

Similar Topics