Showing 500 (Internal Server Error) using backbone.js with slim.php when only adding new model -
i got code https://github.com/ccoenraets/backbone-cellar trying learn backbone.js. when trying add new model database using slim.php, showing 500 (internal server error). when trying fetch, update, delete working good. why showing error on adding ?
plz me, thanks.
window.wineview = backbone.view.extend({ initialize: function () { this.render(); }, render: function () { $(this.el).html(this.template(this.model.tojson())); return this; }, events: { "click .save" : "beforesave", "click .delete" : "deletewine" }, beforesave: function () { var self = this; var check = this.model.validateall(); if (check.isvalid === false) { utils.displayvalidationerrors(check.messages); return false; } // upload picture file if new file dropped in drop area if (this.picturefile) { this.model.set("picture", this.picturefile.name); utils.uploadfile(this.picturefile, function () { self.savewine(); } ); } else { this.savewine(); } return false; }, savewine: function () { var self = this; this.model.save(null, { success: function (model) { self.render(); app.navigate('wines/' + model.id, false); utils.showalert('success!', 'wine saved successfully', 'alert-success'); }, error: function () { utils.showalert('error', 'an error occurred while trying add item', 'alert-error'); } }); }, deletewine: function () { this.model.destroy({ success: function () { alert('wine deleted successfully'); window.history.back(); } }); return false; } });
i had same problem. in /tutorial/api directory; open index.php , first line in function addwine():
error_log('addwine\n', 3, '/var/tmp/php.log');
comment line:
//error_log('addwine\n', 3, '/var/tmp/php.log');
this should solve problem, did mine.
Comments
Post a Comment