I am exploring web development using angularJs and python When i try to make an ajax call to execute a script in python i receive the whole text inside the python script rather than the result. I am running a basic python 2.7 httpserver.
This is my code:
Ajax call from javascript
$scope.login = function(userName,password){
$http({
method : "GET",
url : "login.py"
}).then(function (response) {
console.log(response.data);
});
};
Python script
import json
userName = ""
password = ""
form = cgi.FieldStorage()
if "userName" in form:
userName = form[userName].value
if "password" in form:
password = form[password].value
print json.dumps(userName)
and the output i receive is uploaded in the following image.