Answer the question
In order to leave comments, you need to log in
How to make Ajax requests to Python files?
Greetings.
Please tell me the simplest example of requesting data via Ajax to a Python file. With PHP everything is done at once.
// Ajax запрос в JS
$('button').click(function(){
$.ajax({
type: 'POST',
url: 'file.php',
success: function(data) {
// do
}
});
});
// Код в PHP
echo 'Something Data';
Answer the question
In order to leave comments, you need to log in
import requests
url = 'http://google.com/favicon.ico'
r = requests.get(url, allow_redirects=True)
open('google.ico', 'wb').write(r.content)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question