Javascript 请使用POST请求
运行以下脚本时,我收到错误“请使用POST请求”。我只是html和javascript的初学者。有谁能帮上忙吗 javascriptJavascript 请使用POST请求,javascript,html,Javascript,Html,运行以下脚本时,我收到错误“请使用POST请求”。我只是html和javascript的初学者。有谁能帮上忙吗 javascript function submitform(){ if (!document.getElementById('reschedule').onclick) { alert("reschedule") } if (!document.getElementById('h
function submitform(){
if (!document.getElementById('reschedule').onclick) {
alert("reschedule")
}
if (!document.getElementById('home').onclick) {
alert("home")
}
if (!document.getElementById('cancel').onclick) {
alert("cancel")
}
}
html是
<html>
<form name="myform" method="post,get" onsubmit="return submitform();">
<input type="submit" id="reschedule" value="reschedule" />
<input type="submit" id="home" value="home" />
<input type="submit" id="cancel" value="cancel" />
</form>
更改此选项:
method="post,get"
为此:
method="post"
在
标记属性中方法属性应为“POST”或“GET”;不是两者都有。提交表单后,您将绑定onclick
事件。无论如何,您不需要单击事件。我尝试了该更改并在JSFIDLE中运行它。。但这一次得到了不同的错误。{“error”:“Shell表单不验证{'html_initial_name':u'initial-js_lib','form':,'html_name':'js_lib','label':u'js lib','field':,'help_text':'','name':'js lib'}}您应该在问题中添加“django”。对不起,我不是django专家。您需要从您的input
标记中删除type=“submit”
。这些是我的html上的3个按钮。我需要3个这样的按钮使用type=“button”
method="post"