0

Through AJAX your supposed to have support for the "PUT" and "DELETE" requests. I have a form that sends data via the "PUT" request and the server acknowledges it but no parameters get sent. The same result happens for the "delete" request. If I change to "post" it works fine. IE 9, Firefox, and Chrome all produce the same result. The put and delete requests are being sent but with no data.

$("#startButton").click(function(){
                $.ajax({url:"http://localhost:8084/Project/servlet",
                    data:parseFormData("simulatorForm"),
                    cache: "false",
                    dataType: "text",
                    contentType: "application/x-www-form-urlencoded",                
                    type:"put",
                    error:function(xhr){alert(xhr.status + xhr.statusText);} });
            });

NOTE: If I change to "post" this works fine. All parameters in my form get transmitted. I tried this in IE, Chrome, and Mozilla Firefox.

I tried doing it in pure javascript but I get the exact same results.

var xmlhttp=new XMLHttpRequest();
           xmlhttp.open("PUT","http://localhost:8084/UtilityDashboard/SensorSimulator",true);
           xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
           xmlhttp.send(parseFormData("simulatorForm"));
Eli
  • 14,779
  • 5
  • 59
  • 77
Usman Mutawakil
  • 4,993
  • 9
  • 43
  • 80

1 Answers1

1

What web-server are you using? Special note about PUT/DELETE requests:

By default IIS 6 does not support PUT and DELETE verbs. To enable this, you need to add a wildcard mapping to the virtual directory of your application, this is as simple as clicking the insert button next to Wildcard application maps in your site or virtual directory properties in IIS Manager and entering the path to aspnet_isapi.dll.

Lets Stack It
  • 80
  • 1
  • 1
  • 6