Hi I am working on a project that use fixture, the problem is when I create a new element with the model create function that use fixture to simulate ajax. Nothing happens on the screen eventough I have followed all the instructions to make working.
My model :
- $.Model('Comment', {
- findAll : 'GET /moment/{momentId}/comments',
- create : function(opt, success, error){
- console.log('comment create');
- return $.ajax({
- url: '/moment/{momentId}/comment',
- fixture: '//fixture/json/moments_list_1.json',
- type: 'post',
- success: success,
- error: error
- });
- },
- update : function(opt, success, error){
- console.log('comment update');
- return $.ajax({
- url: '/moment/{momentId}/comment/{commentId}',
- type: 'put',
- success: success,
- error: error
- });
- },
- destroy : 'DELETE /moment/{momentId}/comment/{commentId}'
- });
- My function that call the model :
- '#comment_field keypress' : function(el, ev){
- if (ev.which == 13) {
- Comment.create({
- momentId : $("#comment_id").val(),
- comment : el.val()
- },
- function(newAttrs) {
- console.log(newAttrs);
- });
- el.val('');
- }
- }
- and my fixture request :
- $.fixture("/moment/{momentId}/comment","/resources/js/fixture/json/moments_list_1.json"); // comment
- $.ajax({type: "post",
- url: "/moment/{momentId}/comment",
- fixture: "/resources/js/fixture/json/moments_list_1.json"
- });