Dear All,
I have one python file on my server ,now i want to run this file whenever on my web form a submit button is pressed.
Kindly please help me out how to do it from client side script.
My current code is menioned below and it is not working ,i am facing problem in giving path.
function runScript() {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState === 4) {
if (request.status === 200) {
alert('Successful … ’ + request.responseText);
} else {
alert('Something went wrong, status was ’ + request.status);
}
}
};
request.open(‘POST’, ‘http://xyz.com/home/abc.py’, true);
request.send(null);
return false;
};
document.getElementById('submitButton').onclick = runScript;
Any kind of help would be appreciate.
Regards,
Vishakha