top button
Flag Notify
Site Registration

How to send data with jquery ajax Delete when consuming RESTful service

+3 votes
682 views

The browser i am using is google chrome. I also tested it in internet explorer and firefox too. But result is same. The post method is working fine for the same rest endpoint, but when i am trying to execute delete method on the same endpoint, it's throwing error with http status code 209 with the reason "failed to form full key for endpoint".

This is how the i am sending the delete request.

$.ajax({
             url: url,
             type: "DELETE",
             dataType:"json",
             data: JSON.stringify(data),
             crossDomain: true,
             contentType:"application/json",
             success:function(result){console.log("Success " + console.log(JSON.stringify(result)))},
             error:function(error){
                        alert("Error Deleting Service.See the console log.");
                        console.log(JSON.stringify(error));
                        },
             }).then(function(response){
                   console.log(JSON.stringify(response));
             });

The POST method:

 $.ajax({
                 url: url,
                 type: "POST",
                 dataType:"json",
                 data: JSON.stringify(data),
                 crossDomain: true,
                 contentType:"application/json; charset=utf-8",
                 success:function(){console.log("Success")},
                 error:function(error){console.log(JSON.stringify(error))},
                 }).then(function(response){
                      console.log(JSON.stringify(response));
                 });

Need help. I have already spent the day on this but not able to find the solution for this. I also tried to append the data params with the url but that too didn't worked.

posted Apr 2, 2015 by Prakash

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Provide some more info -
Is ajax been executed or returning the error in the case of delete i.e. r u seeing the alert??
It's not showing the alert. I am getting the success instead with:
{ "cid": "qvbb", "code": 209, "error": true, "params": null, "reason": "failed to form full key for networking.vswitch.domain.ports, bad domain, port", "result": false }.
logged in the console
No clue from the provided info, only I can guess is some problem with networking.vswitch.domain.ports, cross check your url also :)

1 Answer

0 votes

As per my suggestion. don't pass any data to delete method from ajax and also delete parameter from delete method and check whether its calling r not. If its called then you have to check with the passing data, try this one it may give some idea to find proper issue.

answer May 15, 2015 by Balamurugan Kn
...