Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

messing about with a bit of php and java script

  • 30-05-2012 1:00pm
    #1
    Registered Users, Registered Users 2 Posts: 760 ✭✭✭


    I'm messing about with a bit of php and java script. when someone click on the button it run a some php code. I test with just using echo hello so I though I replace the code with the php include function.
    But it is not work, is there something I am doing wrong ?
    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function rss()
    {
    //var php ="<?php echo 'hello'; ?>";
    var php ="<?php include (rss3.php); ?>";
    document.write(php);
    }
    </script>
    </head>
    <body>
    
    
    
    <button type="button" onclick="rss()">Rss feed</button>
    
    </body>
    </html>
    
    


Comments

  • Registered Users, Registered Users 2 Posts: 760 ✭✭✭mach1982


    I figure how to do this, use AJAX


  • Registered Users, Registered Users 2 Posts: 12,351 ✭✭✭✭starlit


    You need to add in php code into your file or a separate PHP file and link them into your HTML/Javascript file.

    I think you may have placed the <? in the incorrect position. Don't think the Doctype line is done correctly that is my opinion, its been a while since I coded PHP and HTML since college but could spot that line may or may not be done correctly.

    I haven't coded in Ajax but maybe look into that.


  • Registered Users, Registered Users 2 Posts: 648 ✭✭✭Freddio


    var php ="<?php include ('rss3.php'); ?>";


    you should call up rss3.php in your browser to see if it is correctly echoing something aswell

    if rss3.php isnt on the same server as this php file then it wont work with an include either


Advertisement