By arunraj
Use the following code to set http headers with backbone's save, fetch and destroy methods.
model.save({ }, {beforeSend: sendHeader,
success : function(data) {
alert("success");
},
error : function(m, xhr, o) {
alert("error");
}
});
success : function(data) {
alert("success");
},
error : function(m, xhr, o) {
alert("error");
}
});
sendHeader : function(xhr) {
xhr.setRequestHeader("name", "tdd");
}
Technology: