0
這是我的python代碼,我想通過按鈕將其顯示在我的html代碼頁面佈局上我只想檢查它是如何在javascript中調用的。想要在我的JavaScript代碼中調用python api。我只是想檢查如何從python調用hello world並在javascript中打印
print("hello world") (savelist.py)
這是我的HTML JavaScript文件
<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>