Sunday, 11 June 2017

My DELETE method doesn't work from a Submit Form

Im trying to get a DELETE request working but it concat's to this: "http://localhost:3000/users/delete?userid=593d774c734d1d02258f5315" it doesnt go trough my app.js listener I have a console log. This is my code. (Oh and Im trying to get it to work with no ajax.

This is the HTML(with ejs):

<form method="DELETE" action="/users/delete">
    <input type="hidden" value="<%= users[i]._id %>" name="userid">
    <input type="submit" value="Submit">
</form>

And this is the Listener:

app.delete('/users/delete',function (req, res) { console.log(req); })

What I do know that the ejs function works as you can see its being passed in the url and Ive tried printing it inside the html.



via mangaluli

No comments:

Post a Comment