views:

361

answers:

1

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

related questions