I have two pages one for filling data and other one for initializing data I am sending the filled data via post method using ajax, I want to redirect the user from initializing page, i used simple header("Location: somelocation");
in the initialize page but it seems it does not work this way and it just sends the html value of the target page using ajax (I checked it with firebug),so what is the alternatives here ? should i use ajax it self for the redirection part?
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
使用php和ajax重定向到另一个页面
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
2条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
duanbin3021 2014-10-30 15:23关注You should return your location via json response, for example {"location": "somelocation"}, and then handle it in ajax success callback and go to page you need:
document.location.href = somelocation
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
编辑预览轻敲空格完成输入- 显示为
- 卡片
- 标题
- 链接
评论按下Enter换行,Ctrl+Enter发表内容
编辑
预览

轻敲空格完成输入
- 显示为
- 卡片
- 标题
- 链接
报告相同问题?
提交
- 2017-09-08 15:52回答 1 已采纳 The selector inside the ajax success handler must be a string, not identifier: success:function(d
- 2018-04-16 07:58回答 1 已采纳 You can save the response to local storage and retrieve after redirecting. complete: function(res
- 2016-01-05 08:02回答 3 已采纳 First, your data parameter in the AJAX call is not using the correct syntax. You're missing brack
- 2020-10-22 18:48其次,禁止浏览器缓存是前端页面调试的另一个常用技巧。因为浏览器缓存页面内容会使得开发者在进行调试时,无法看到最新更改的效果。WordPress提供了一个nocache_headers()函数,这个函数用于向浏览器发送一系列...
- 2015-01-13 09:19回答 2 已采纳 Agree with @marc. Just to add more information, do this. <a href='download.php?file=some_file
- 2021-11-14 13:33回答 2 已采纳 这个很简单,比如你要存一个对象,先定义一个空的数组arr,然后跳转的时候session.set("arr"),另一个页面取值,直接let arrData =session.get("arr"),取到这
- 2014-04-03 08:48回答 1 已采纳 You don't need AJAX for this: function ouvrirEditFormulaire(id,date,heure,client) { var url
- 2021-10-13 19:48AdamShyly的博客 我在JS使用AJAX异步与PHP对接做一个页面的登录注册系统的时候就碰到了跨域问题(感觉这个问题很常见),先大致分析一下跨域问题产生的原因:当域名、端口、协议至少有一者不同时,则称两个页面不同源,而由于受同源...
- 2021-07-24 19:34回答 3 已采纳 1.双重请求问题: 对于js提交php请求,如果已经决定使用ajax,那么在form上就不用再填写表单的提交方式post,和提交目的地址 action。否则,当你点击按钮的时候,就会发送两个请求出去。
- 2016-12-30 16:24回答 1 已采纳 It should point to the URL of the script that performs whatever function you need the AJAX request
- 2021-12-11 14:33回答 1 已采纳 你应该是用原生js吧用获取到的数据生成html片段,然后插入到页面中.例如: 获取到的数据是data=[ ] for(let i =0;i<data.length;i++){
- 2023-03-22 06:06m0_49544213的博客 通过请教chatgpt得到了解决...刚刚在做页面登录的时候,前端界面使用ajax将数据传输至后台,但是后台验证通过了之后无法实现重定向。// 请求成功后执行的代码。// 请求失败后执行的代码。希望这些信息能对您有所帮助!
- 2018-05-16 04:05dearbaba_8520的博客 How can I redirect the user from one page to another using jQuery or pure JavaScript? 如何使用jQuery或纯Ja
- 2020-10-20 21:19当用户在前端界面上触发一个事件(如点击按钮或填写表单),通常会通过HTTP请求发送数据到服务器。这些请求可以是GET或POST类型,携带的数据由前端JavaScript处理并封装。服务器端的PHP接收请求,解析数据,执行相应...
- 2021-08-06 00:31郑业成的博客 通常我们使用shiro,登录之后就会跳到我们上一次访问的URL,如果我们是直接访问登录页面的话,shiro就会根据我们配置的successUrl去重定向,如果我们没有配置successUrl的话,那么shiro重定向默认的/,这个逻辑看...
- 没有解决我的问题, 去提问
联系我们(工作时间:8:30-22:00)
400-660-0108kefu@csdn.net在线客服
- 京ICP备19004658号
- 经营性网站备案信息
公安备案号11010502030143
- 营业执照
- 北京互联网违法和不良信息举报中心
- 家长监护
- 中国互联网举报中心
- 网络110报警服务
- Chrome商店下载
- 账号管理规范
- 版权与免责声明
- 版权申诉
- 出版物许可证
- ©1999-2025北京创新乐知网络技术有限公司