0
これは私のpythonコードです。ボタンを使ってHTMLコードページレイアウトに表示したいのですが、javascript 。javascriptコードでpython apiを呼び出したいと思います。私はちょうどhello worldがpythonから呼び出され、javascriptで印刷されていることを確認したいです
print("hello world") (savelist.py)
そして、これは、ファイル
<html>`<html>`
<head>
hjgkhkj
</head>`enter code here`
<body>
<input type="text" name="name" id="name">
<button type="button" id="home" onclick="validate()" value="checkvalue">
<script>
$('#id').click(function(){
$.ajax({
type:'get',
url:<YOUR SERVERSIDE PAGE URL>,
cache:false,
data:<if any arguments>,
async:asynchronous,
dataType:json, //if you want json
success: function(data) {
<put your custom validation here using the response from data structure >
},
error: function(request, status, error) {
<put your custom code here to handle the call failure>
}
});enter code here
});
</script>
</body>
</html>