1👍
Typically I would use jQuery and its post method. This makes an ajax call to the server using POST without having to reload the page. (jQuery takes a little bit to learn but is soooo much easier to then JavaScript because of its shortcuts)
http://api.jquery.com/jquery.post/
$.ajax({
type: "POST",
url: "/post/{{post.id}}/vote/1",
success: function(){
//Do something here that lets the user know things worked out
}
});
If you are not inclined to using jQuery you can make the same type of call using normal JavaScript, though it has a little bit more to it in my oppinion.
http://www.javascriptkit.com/dhtmltutors/ajaxgetpost2.shtml
Either way this could be applied to a button’s “onclick” event and then the response could be handled and processed before being returned to the user. i.e. let the user know if the request was successful or failed.
EDIT:
Not sure why you need a post for that it looks like because all of the data is contained in the URL and nothing is being sent along as part of the header, you could simply use a GET request.