[英]Symfony project not redirect me well, using JavaScript
I'm doing a project with Synfony and I have included a button 'submit' which when pressed I must make an insert into my database and then must take or redirect to the "reportepreliminar.html" page using JavaScripts: 我正在使用Synfony做一个项目,并且添加了一个“提交”按钮,按下该按钮时,我必须在数据库中进行插入,然后必须使用JavaScript将其插入或重定向到“ reportepreliminar.html”页面:
This is the code you use to redirect: 这是您用于重定向的代码:
window.location.href = "reportepreliminar.html";
This is my home page where my button is: 这是我的主页,我的按钮是:
(1) http://localhost/apis/web/app_dev.php/general/1 (1) http://localhost/apis/web/app_dev.php/general/1
and this I want to get, when you press: 当您按以下按钮时,我想得到这个:
(2) http://localhost/apis/web/app_dev.php/general/reportepreliminar.html (2) http://localhost/apis/web/app_dev.php/general/reportepreliminar.html
The problem is when I press the button, the URL changes to (2) but in the browser always displays the home page (1) . 问题是当我按下按钮时,URL更改为(2),但在浏览器中始终显示主页(1) 。
I do not understand that you can be doing wrong? 我不明白您做错了吗?
regards 问候
尝试这个
window.location.href = "{{ path('route_name_of_reportepreliminar.html') }}";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.