I have a menu of links that need to have additional parameters added using data from cookies. I need to be able to do this client-side and not server-side.
Basically I have a menu like this:
<ul class="main_menu">
<li><a href="/link/to/page1"> Page 1 </a></li>
<li><a href="/link/to/page2"> Page 2 </a></li>
<li><a href="/link/to/page3"> Page 3 </a></li>
</ul>
And a cookie with a number like this:
users_number = jQuery.cookie("users_number");
I am trying to get the 'users_number' to be included as a POST parameter to all of the links on that menu (ie. /link/to/page1?users_number=thecookievalue) What I don't want is users to be able to see this in their URL bar.
Right now I am using:
jQuery('.main_menu>li>a').attr('href', function() {
users_number = jQuery.cookie("users_number");
return this.href + '?users_number=' + users_number;
});
This functions as I wanted but I am trying to figure out how to do this in a way where the user does not see the ?parameters at the end of their URL. Is there a way to do this same thing but without them being able to see it?
Any help would be hugely appreciated -- thanks!