3

I tried to send an ajax delete request to this url But getting a pop up error.

$( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
            "Delete": function() {
                //To show the loader                    

                //Ajax call to delete the data          
                $.ajax({
                    type: "DELETE",
                    url: window.location.pathname + id + '/centers/' + c,
                    contentType: 'application/html; charset=utf-8',
                    data: {
                        dc : dc,
                    },
                    success: function(){} }); });

Error is

This web page is being redirected to a new location. Would you like to resend the form data you have typed to the new location?

https://my2.v2.domain.com/grd/net/lb/checker/Env2/centers/11

(This is a demo url to which i am sending.)

Thanks in advance

tom joy
  • 411
  • 8
  • 22
  • Please provide more information - what is triggering the AJAX? What code are you actually using? – Ian Nov 26 '12 at 07:33
  • 1
    IE 7 and 8 do not support `DELETE` and `PUT` methods..http://stackoverflow.com/questions/2153917/how-to-send-a-put-delete-request-in-jquery & http://stackoverflow.com/questions/2456820/problem-with-jquery-ajax-with-delete-method-in-ie – web-nomad Nov 26 '12 at 07:53
  • I tried in firefox 14.0.1 but same error – tom joy Nov 26 '12 at 07:56
  • Can you create a jsfiddle for your code, which makes the request. Would help us in looking into the issue. – web-nomad Nov 26 '12 at 08:04
  • What is the 'id' param and why are you adding it to the path name? I think you should separate the path name and id with a '/'. – dinesh ygv May 30 '14 at 12:29

1 Answers1

0

Not all browsers support redirects when using the DELETE method (or PUT or POST). The solution is to check in your browser debug console to which location you're being redirected (check the Location header), and then adjust the URL in your code to submit directly to that URL so that it does not redirect.

All modern browsers support the DELETE method.

Blaise
  • 13,139
  • 9
  • 69
  • 97