this is my function in backbone.js
var formdata = {
name : this.$('#name').val(),
email : this.$('#email').val()
};
this.collection.create(formdata, {
wait : true,
success : function(model, res) {
var id = model.get('id');
}
});
When I use console.log(id)
inside the success function it's been displayed. But I can't access outside of the success function.
Does anyone got the answer..