forzatio Posted January 27, 2007 Share Posted January 27, 2007 Hi, I have some php code that I want to echo inside a javascript, when clicking the item with javascript attached it should display the echo on my page.It works fine on my localhost php version 5.20 , but on some servers online that use version 4.3.11 and 4.4.4 , It just doesn't work and the page stops loading when it reaches the javascript.Are those earlier versions not capable of doing that ?, how can I else reach the same goal. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 27, 2007 Share Posted January 27, 2007 Please post you code. We can't help you if we don't see what you're attempting.Actually, since Javascript runs on the client (i.e. Browser) and PHP runs on the Server, what you're attempting shouldn't work at all unless you are using AJAX techniques.Ken Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 You probably have a javascript error, can you post a link? Quote Link to comment Share on other sites More sharing options...
forzatio Posted January 28, 2007 Author Share Posted January 28, 2007 Ok so with this code the include is done inside the javascript, the spoiler (include.php) becomes visible when the user clicks on the text Find out the spoiler.[code] <DIV align=center> <p><a href="javascript:InsertContent('spoiler')" class="link">Find out the spoiler !</a></p> <div id="spoiler" style="font-size: 24px; display: none;"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD> <?php include ('include.php');?> </TD> </TR> </TBODY></TABLE><script type="text/javascript" language="JavaScript"><!--function InsertContent(d) {document.getElementById(d).style.display = "";}//--></script> </div>[/code] Quote Link to comment Share on other sites More sharing options...
forzatio Posted January 28, 2007 Author Share Posted January 28, 2007 sorry for the jump guys, I see that using src in the javascript is an option too but the content is then not really a part of my page but just linking.. there must be a way too use php for the javascript above ? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 "Ok so with this code the include is done inside the javascript"No, it's not. Quote Link to comment Share on other sites More sharing options...
forzatio Posted January 28, 2007 Author Share Posted January 28, 2007 [quote author=jesirose link=topic=124341.msg515522#msg515522 date=1170009547]"Ok so with this code the include is done inside the javascript"No, it's not.[/quote]well not technically but when you see the code it is ;) anyway it was merely for you to see what I want to do with this code. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 If I were you I'd look into the Mootools js framework (mootools.net) - it makes js effects simple. Without a link to the live site, I can't help you any further. Quote Link to comment Share on other sites More sharing options...
forzatio Posted January 28, 2007 Author Share Posted January 28, 2007 [quote author=jesirose link=topic=124341.msg515597#msg515597 date=1170014056]If I were you I'd look into the Mootools js framework (mootools.net) - it makes js effects simple. Without a link to the live site, I can't help you any further.[/quote]Hello I have a link to a live site now. Example of what I want is here:http://www.delux-pass.com/test.phptext which toggles the javascript:"CLICK HERE TO SEE THE ANSWER" Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 And what's the problem? When I click it, text shows up. Quote Link to comment Share on other sites More sharing options...
forzatio Posted January 28, 2007 Author Share Posted January 28, 2007 [quote author=jesirose link=topic=124341.msg515666#msg515666 date=1170017900]And what's the problem? When I click it, text shows up.[/quote]wait a minute with this example I see the problem finally.. in the include php there was a str_[b]i[/b]replace which their server can't handle but it didn't gave me an error though. except for that the page only loaded untill the javascript.anyway I found out what was wrong by this example, It does seem to work though then, but actually it shouldn't be working at all ? as I understand from above. Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted January 28, 2007 Share Posted January 28, 2007 [quote]It does seem to work though then but it shouldn't ?[/quote]As an honest tip try to look over your sentences and see if they read well before you submit a post. Quote Link to comment 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.