0

i have the follwing HTML with javascript calling a PHP file

 <html>
 <head>
 <script type="text/javascript" src="jquery.min.js"></script>
 <script type="text/javascript">
    function doSomething() {
       $.get("mySample.php");
       return false;
     }
 </script>
 <body class="page_bg">
 <a href="#" onclick="doSomething();">Click Me!</a></head>
 </body>
 </html>

when it is executed it should call up "mySample.php" script, whose code is given below

 <?php
 #if ($_GET['run']) 
 {
  # This code will run if ?run=true is set.
   exec("python visualization.py");
 }
 ?>

then this piece of code calls up the python script called visualization.py, which results in some.html file, which i want to get back in the browser.

  1. Given above approach is not working
  2. Is it correct?

2 Answers 2

1

If you want to display your data when you call you need to handle the response you're getting. I think this will work:

$.get("mySample.php", function(resp){
    $('body').html(resp);
});

And have you tested if your php file works?

Sign up to request clarification or add additional context in comments.

Comments

0

Try this code:

$.get( "mySample.php", function(data) {
  $('body').html(data);
  alert( "Load was performed." );
});

More detail: http://api.jquery.com/jquery.get/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.