Run a python script through a web server and return results to javascript via $.post() - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:post

Description

Run a python script through a web server and return results to javascript via $.post()

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
  <script type="text/javascript">
        function flipData(){/*w  w w. j a  v a 2 s . c om*/
            $.post("http://localhost:38123/", { data: "makeitbackwards" },
            function(data){
                    console.log(data);
            }, "json");
        }
    
      </script> 
 </head> 
 <body> 
  <a href="javascript:void(0)" onclick="flipData()">Get Time</a>  
 </body>
</html>

Related Tutorials