title: Calling python function in server from local machine using angularjs
body: <p>I am having problem in calling a python function with  angularjs $http request.
  I am having a python function which is on server like this </p>
  
  <pre><code>import cgi, cgitb
  data= cgi.FieldStorage()
  name = data.getvalue("name");
  age = data.getvalue("age");
  def printinfo( name, age ):
      print "Name: ", name
      print "Age ", age
      return name,age
  </code></pre>
  
  <p>and i've also included cgi and my javascript code is </p>
  
  <pre><code> angular.module('app1',[])
   .controller('ctrl',['$scope','$http' ,function ($scope,$http) {
  
   $scope.bin = 'examp';
   $scope.go = function () {
          var url = "http://localhost/dump/test/test.py";
  
     var bad =$http({
              url :url ,
              method:'POST',
              data:{"name":"kumar" , "age":21}
          }).success(function(data){
           alert("working");
         });
      }
  
   }])
  </code></pre>
  
  <p>and my javascript code is able to make a call to <a href="http://localhost/dump/test/test.py" rel="nofollow">http://localhost/dump/test/test.py</a> but it is shown as a document even when i included cgi in it ..
  Please guide me and also can you guys tell me is it the right way to send the values to server ie can i invoke the function print info by just sending name and age or should i send the function name too. If yes let me know how can i pass it ..</p>
  
  <p>Thanks in advance..</p>