【发布时间】:2017-04-21 10:33:09
【问题描述】:
这是我的 python 代码,我想通过按钮在我的 html 代码页面布局上显示它我只想检查它是如何在 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>
【问题讨论】:
标签: javascript python html ajax api