Simple solution would be have an "asp hidden field" control in javascript bind that varaible value to that hidden field. thats it now you can get the hidden field value in server side. check the below sample code for setting the javascript variable to asp hidden field.
var hfObj = document.getElementById('<%=HiddenfieldId.ClientID%>');
hfObj.value = "the value you want to assign";
in server side like the usual way
string someVar = HiddenfieldId.value;
Is this what you required?