Calling java script in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Dheeraj Joshi
    replied
    That file calls C functions inturn...

    And returns the value.

    Basically i try to wrap few functions through PHP...

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    Originally posted by dheerajjoshim
    It just returns a value.
    that’s the obvious part…

    maybe I should be more clear:

    I wonder what myfile.php is for…

    Leave a comment:


  • Dheeraj Joshi
    replied
    It just returns a value.:)

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    I just wonder what myfile.php does………

    Leave a comment:


  • Dheeraj Joshi
    replied
    People....... I forgot to tell you.


    I am getting the alert box in PHP............ .....

    Bingo.

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    Originally posted by Jezternz
    didn't I say that above :(
    many things need to be told multiple times, until they sink in (I mean, are noticed)

    Leave a comment:


  • Jezternz
    replied
    didn't I say that above :(

    Leave a comment:


  • gopan
    replied
    Originally posted by Markus
    As mentioned before, that won't work because you're not asking PHP to do anything with the string, it's the same as
    Code:
    <?php
    "hi, my name is Mark";
    which obviously will not output anything.
    yaa my bad Mark...

    he need to add an echo before the quotes... I din't see that...

    The corrected code will be...
    Code:
    <html>
    <body>
    <?php
     
    $res = `php myfile.php`;
     
    switch($res)
    {
        case 1: 
           echo "<script language=\"javascript\"> 
                alert('Blah Blah')
            </script>";
            break;
        case 2: echo "Choice 2";
            break;
        case 3: echo "Choice 3";
            break;
        default:echo "No choice";
            break;
    }
     
    ?>
    </body>
    </html>
    and if $res is holding value one... the javascript will alert "blah blah"

    Leave a comment:


  • Markus
    replied
    Originally posted by gopan
    Dear dheerajjoshim,
    If you're getting $res as 1 then look at the code line#9
    Code:
    case 1: "<scriptlanguage=javascript>
    and change it to

    Code:
    case 1: "<script language=\"javascript\">
    As mentioned before, that won't work because you're not asking PHP to do anything with the string, it's the same as
    Code:
    <?php
    "hi, my name is Mark";
    which obviously will not output anything.

    Leave a comment:


  • gopan
    replied
    Dear dheerajjoshim,
    If you're getting $res as 1 then look at the code line#9
    Code:
    case 1: "<scriptlanguage=javascript>
    and change it to

    Code:
    case 1: "<script language=\"javascript\">

    Leave a comment:


  • Dormilich
    replied
    Originally posted by Markus
    Do a var_dump() on your $res variable.
    general advice: this is one of the things to be done first.

    Leave a comment:


  • Markus
    replied
    It'll return a string, I imagine. Do a var_dump() on your $res variable.

    Leave a comment:


  • Dheeraj Joshi
    replied
    Generally languages have a tendency to print not to return unless we say it so.

    Regards
    Dheeraj Joshi

    Leave a comment:


  • Dormilich
    replied
    Originally posted by dheerajjoshim
    You mean return type right?
    yepp, though I don’t know if that’s return or echo. didn’t work with the CLI version of PHP so far.

    Leave a comment:


  • Dheeraj Joshi
    replied
    You mean return type right?

    Regards
    Dheeraj Joshi

    Leave a comment:

Working...