0

I have created a book library project using REST+JSON which has an HTML page having many options. One of them is delete, but I am unable to use it in as HTML doesn't define it. Can any tell me how to use that HTTP method? Example:

<form action="rest/bklib/remove" method="DELETE">
Enter BookName:<input type="text" name="Bookname">
<p>
<input type="submit" value="delete">
<p>
</p>
</form>
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189

2 Answers2

0

This post by Scott Hanselman could be helpful in your case.

From the post:

One thing you can do is to "tunnel" HTTP Methods inside another HTTP Header. Basically you have a header that says "No, seriously, I know I got here via a POST, but use this one instead." You would still POST, but then you'd have "X-HTTP-Method-Override:PUT" as a header.

I haven't use it myself, but, hey, if Scott says it, I'd give it a go.

U r s u s
  • 6,680
  • 12
  • 50
  • 88
-1

DELETE is a http standard not a html standar. HTML only knows GET and POST. I did hear that HTML5 accepts PUT and DELETE, but I'm not sure.

For doing DELETE requests you should use Ajax or jquery. I also recommend you to use ajax for GET and POST.

Vincent Beltman
  • 2,064
  • 13
  • 27