【发布时间】:2014-12-05 04:12:41
【问题描述】:
我有一个使用 jquery post 提交表单的 ember 操作,
submit : function(){ //submitting new story
this.set('onsubmit' , true);
var self = this;
$.post( "/api/post", { some post data })
.done(function(data) {
self.transitionTo('post' + data);
});
}
网址是这样的,域 example.com。帖子位于 example.com/api/post。发布后,用户必须重定向到 example.com/post/3432232(发布数据返回的一些值)。
但是,在将此转换发布到“example.com/api/post/5000203”而不是 example.com/post/234234234 之后。
哪个不存在并给出 404。如何使用 ember 中的转换功能让用户返回 example.com/post/234234234?
编辑 - 路线如下
App.Router.map(function() {
this.resource('index', {path : '/'} , function() {
this.resource('p', function(){
this.resource('post', { path: ':post_id' });
});
});
});
谢谢
【问题讨论】:
标签: javascript jquery ember.js