If you work with links, links are sent at the GET request to the server, then the parameters are specified in the URL. Perhaps you have two options:
1 - the parameters should be on the data attributes, such as data-id="83" , and then create a form for sending data by mail and create input tags with data-x attributes, for example:
<a href="my/url" data-id="83> link </a>
then using javascript you need to create a form:
<form method="POST" action="my/url"> <input value="83 name="id" type="hidden" /> </form>
and fire the event with a JS submit form: jQuery('form').submit()
2 - you can encrypt and then decrypt the receive parameters in the controller: How to encrypt and decrypt data in MVC?
Edit
An example for the first paragraph:
Html:
<div id="container-generic-form" style="display:none;"> <form action="" method="POST"></form> </div> <a href="my/url" data-id="83" data-other="blue" class="link-method-post">my link</a>
JS:
$(function() { // document ready var controlAnchorClickPost = function(event) { event.preventDefault(); // the default action of the event will not be triggered var data = $(this).data(), form = $('#container-generic-form').find('form'); for(var i in data) { var input = $('<input />', { type: 'hidden', name: i }).val(data[i]); input.appendTo(form); } form.submit(); }; $('a.link-method-post').on('click', controlAnchorClickPost); //jquery 1.7 });
source share