ajax - ajax成功导航到另一个页面的Framework7不起作用
问题描述
所以我将 phonegap/framework7 用于我正在开发的应用程序
我有以下 ajax 调用,它工作得很好..
$.ajax({
method: "POST",
url: myApi+ "ratings",
data: ratingForm,
success: function() {
//works fine
alert("test success");
//this part doesn't work!
app.router.navigate("/success/");
},
error: function () {
app.dialog.alert('We apologize, an error
occurred while trying to saving your rating. Please try
again.');
}
});
不工作的部分是 app.router.navigate("/success/"); 部分。我在控制台中没有错误。如果从程序中的其他任何地方调用此函数确实有效,所以我不确定在 ajax 成功后如何处理重定向,任何帮助将不胜感激。
解决方案
经过大量的游戏最终,我得到了它的工作......我正在使用选项卡式布局,我在 app.js 中有以下内容
var composeView = app.views.create('#view-compose', { url: '/compose/' });
在我的 ajax 成功上,我现在正在做......
composeView.router.navigate("/success/");
并且路由正确,感谢所有帮助的人!
推荐阅读
- angular - 使用 MEAN 堆栈验证不记名令牌 API
- laravel - 数据表列表页面的字段选择器
- swift - 传递给不带参数的调用的参数 - Swift
- image - 如何在 gnu 八度音程中显示旋转后的图像?
- apache-spark - PySpark 创建ticket___HIVE_DEFAULT_PARTITION__ 文件夹
- regex - 正则表达式将整个数字与后向和前瞻逻辑匹配
- python - 如何防止 gunicorn eventlet 工作人员在 Flask-APScheduler 长时间运行的任务中超时退出?
- mongodb - 如何匹配由连字符和空格等特殊字符组成的字符串
- html - 如何在 servicenow 中设计表格
- excel - 如何将图表从一张表复制到另一张表或设置图表的目的地?