flask+ajax post方法不执行 >_<
本文介绍了flask+ajax post方法不执行 >_<的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我在js中想进行ajax的post请求,但是$.ajax(...)方法就是不执行,而且后台没有任何报错,在下眼拙,哪位大神火眼金睛,给点指导,O(∩_∩)O谢谢~~~
...
<input id="curr_page" type="button" name="curr_page" value="1">
...
<script type="text/javascript">
var str1 = document.getElementById('curr_page')
str1.onclick = function(){
$.ajax({
type: "post",
url: "{{ url_for('auth.login') }}",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: document.getElementById('curr_page').innerHTML,
success:function(data){
alert(data);
}
});
}
</script>
然后我试另一种方法,这个post方法依旧没有执行
<script type="text/javascript">
var str1 = document.getElementById('curr_page')
str1.onclick = function(){
$.post("{{ url_for('auth.login') }}",
{
page : document.getElementById('curr_page').innerHTML
},function(data,status){
alert(data+status)
});
}
</script>
解决方案
F12,把见到的错都说出来
这篇关于flask+ajax post方法不执行 >_<的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文