javascript - Ajax delete returns 200 but firing off error event -
i have read through loads of posted threads , none seem deal delete. code returning 200 status yet fires of error event...
$.ajax({ type: 'delete', url: '/' + type + '/' + name, success: function() { window.alert(type + " " + name + " successful"); }, error: function(xhr, status) { alert(xhr.status); alert('failed delete ' + type + ' ' + name) } });
i think it's because of type: 'delete'
. change type: 'json'
or remove @ all. since returning wrongly formatted response, error callback fired. safe if specify json
type , echo besides of json string.
Comments
Post a Comment