$.ajax({ ???????????????url : ‘/delete/‘, ?#地址 ???????????????type: ‘POST‘, ???#传输方式 ???????????????data: {‘nid‘: objs}, #传输数据 ???????????????dataType: ‘JSON‘, ??#传回来的数据格式 ???????????????traditional: true, ???#传送列表元素 ???????????????success: function (obj) { ????????????????????if(obj.status){ ????????????????????????location.reload() #刷新页面 ????????????????????} ???????????????} ???????????})
在html中的书写
在views中
import json
red = {‘status’:True, ‘error’:None, ‘data‘:None}
nid = request.GET.get(‘nid‘) #接收数据
return Httpresponse(json.dumps(red))
$.ajax({})
原文地址:https://www.cnblogs.com/my-love-is-python/p/9362908.html