How can I do an X-HTTP-Method-Override for an ajax request in jQuery?
+4
A:
You could set custom headers when performing an ajax request by using the beforeSend callback:
$.ajax({
beforeSend: function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', 'PUT');
},
type: 'POST',
url: '/someurl',
success: function(data){
// do something...
}
});
Darin Dimitrov
2009-11-28 17:38:38