当前位置: 首页 > news >正文

河北住房建设厅网站首页百度推广关键词规划师

河北住房建设厅网站首页,百度推广关键词规划师,wordpress 截取,论坛交流平台有哪些我一整天都在为这事犯愁。似乎什么都没用。这是我的情况。在我有一个Django表单#xff0c;有两个字段#xff1a;redirect_from#xff0c;redirect_to。此表单有两个提交按钮#xff1a;Validate和{}。当页面加载时#xff0c;Submit被隐藏#xff0c;只显示Validate。…我一整天都在为这事犯愁。似乎什么都没用。这是我的情况。在我有一个Django表单有两个字段redirect_fromredirect_to。此表单有两个提交按钮Validate和{}。当页面加载时Submit被隐藏只显示Validate。在所以现在当用户填充这两个字段并单击Validate时我使用Ajax来确认这两个字段是相同的。如果是则显示Save按钮。单击Save按钮应将表单保存到数据库中。我还添加了一个oninput监听器这样在Ajax调用之后如果用户试图更改数据Save按钮将再次隐藏他现在必须再次计算它。在显然使用Ajax应该很容易但是我发现它非常困难和令人沮丧。到目前为止我的代码是我的模板form methodpost{% csrf_token %}{% include partials/form_field.html with fieldform.redirect_from %}{% include partials/form_field.html with fieldform.redirect_to %}SaveValidate{% endblock %}{% block extra_scripts %}{{ block.super }}$(document).ready(function() {$(#submit).hide()});$(#id_redirect_to).on(input, function(){$(#submit).hide()});console.log(hello)//For getting CSRF tokenfunction getCookie(name) {var cookieValue null;if (document.cookie document.cookie ! ) {var cookies document.cookie.split(;);for (var i 0; i cookies.length; i) {var cookie jQuery.trim(cookies[i]);if (cookie.substring(0, name.length 1) (name )) {cookieValue decodeURIComponent(cookie.substring(name.length 1));break;}}}return cookieValue;}//For doing AJAX post//When submit is click$(#ajax_submit).click(function(e) {console.log(Clicked)e.preventDefault();//Prepare csrf tokenvar csrftoken getCookie(csrftoken);//Collect data from fields/*var email $(#inputEmail).val();*/var redirect_from $(#id_redirect_from).val();var redirect_to $(#id_redirect_to).val();console.log(URL from and to is, redirect_from, redirect_to)/*var password $(#inputPassword).val();*///Send data$.ajax({url : window.location.href, // the endpoint,commonly same urltype : POST, // http methoddata : { csrfmiddlewaretoken : csrftoken,redirect_from : redirect_from,redirect_to : redirect_to/*password : password*/}, // data sent with the post request// handle a successful responsesuccess : function(json) {console.log(json); // another sanity check//On success show the data posted to server as a messageif (json[redirect_success] true){alert(They are the same! json[redirect_success] !. );$(#submit).show()}else{$(#submit).hide() //Maybe display some error message in the future!}},// handle a non-successful responseerror : function(xhr,errmsg,err) {console.log(xhr.status : xhr.responseText); // provide a bit more info about the error to the console}});});{% endblock extra_scripts %}我的观点^{pr2}$我得到了500: MultiValueDictKeyError at Save有人能把我引向正确的方向吗对ajax很陌生。在
http://www.yutouwan.com/news/454300/

相关文章:

  • 如何建立自己的购物网站深圳免费做网站
  • 网站推广 营销网站推广的措施和手段有哪些
  • html网站源码网页游戏排行榜前十2023
  • 做个网站找别人做的吗google浏览器官网下载
  • 东莞微信网站建设报价九江做网站哪家公司好
  • 南阳做网站收费wordpress更改数据库域名链接
  • 高端大气网站建设权威的手机排行榜网站
  • 网站建设方案书简单网站侧边栏
  • p2p网站建设要多少钱海珠区住房和水务建设局网站
  • 订制网站海报模板网址
  • 宁波建网站费用google海外推广
  • 沧州网站建设 网络服务做网站必须购买空间吗?
  • 潍坊软件网站开发商务互联 网站
  • 空间设计网站四川建筑培训网
  • 温州网页模板建站做ppt很有创意的网站
  • 网站导航网址大全荣耀正品查询入口
  • 大连网站建设哪家公司好站长工具站长之家官网
  • 全国城建中心官方网站网页游戏传奇盛世开服表
  • 罗湖商城网站建设哪家好金山网站建设推广
  • 浙江省网站建设报价建立自己的摄影网站
  • 网站代码有哪些文网站建设费用计入什么科目
  • 建设银行网站证书网站建设 食品
  • 做网站需要知道什么软件计算机软件开发是干什么的
  • 电商设计素材网站有哪些重点培育学科建设网站
  • 网站建设工作人员有哪些职责网络推广加盟
  • 企业网站怎么搜索优化邯郸住宅与房地产信息网
  • 手机如何制作一个网站建设摩托车型号大全
  • 手机网站淘宝客网站前后台模板
  • 自己做网站的成本要哪些东西梅州网站建设求职简历
  • 个人博客网站域名注册网络推广网站公司推荐