标签:back code else http submit href serial color jquery
<a id="ajax_submit">悄悄提交</a> <script> $(‘#ajax_submit‘).click(function () { $.ajax({ url:"/host/", type:‘POST‘, data:{‘k1‘:123,‘k2‘:‘root‘}, success:function (data) { alert(data) if(data ==‘OK‘){ location.reload() }else{ alert(data) } } }) }) </script>
<a id="ajax_submit">悄悄提交</a>
httpresponse(json.dumps(ret))
parse()#前端转换成json
$(‘#form‘).serialize(),#表单中的值全部发到后台
getlist
traditional:true#发送列表不处理
Ajax:
$.ajax({
url: ‘/index/‘,
data: {‘k‘: ‘v‘, ‘list‘: [1,2,3,4], ‘k3‘: JSON.stringfy({‘k1‘: ‘v‘}))}, $(form对象).serilize()
type: ‘POST‘,
dataType: ‘JSON‘:
traditional: true,
success:function(d){
location.reload() # 刷新
location.href = "某个地址" # 跳转
}
})
标签:back code else http submit href serial color jquery
原文地址:https://www.cnblogs.com/anhao-world/p/14635341.html