[英]Django POST method using Jquery
Im trying to do a POST request using JQuery but my JQuery scripts fails when I add the .ajax call. 我试图使用JQuery发出POST请求,但是添加.ajax调用时,我的JQuery脚本失败。
When I remove the ajax calls the alert method is displayed without any problems. 当我删除ajax调用时,显示的警报方法没有任何问题。
Question: 题:
What would be the syntax error or possible other errors? 语法错误或可能的其他错误是什么?
$("#table_appl,#table_enfr,#table_det01,#table_det02,#table_det03,#table_det04,#table_det05,#table_datais").on( "click", "input:submit", function( event ) {
alert('Hi')
//event.preventDefault();
$.ajax({
type:"POST",
url:"/validate/"
success:function(data){
alert(data);
}
});
return false;
})
A few things I would change: 我会改变的几件事:
1. Change: 1.变更:
"input:submit"
to: 至:
'input[type="submit"]'
2. Change: 2.变更:
url:"/validate/"
to: 至:
url:"/validate/",
3. Specify data
in your $.ajax
call. 3.在
$.ajax
调用中指定data
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.