title: How to pass a dynamic ID to a function in JQuery
body: <p>Update:</p>
  
  <p>in my code-behind code i have public varaible and assing like this </p>
  
  <pre><code>public string Id { get { return Request.QueryString["id"].ToString(); } }` 
  </code></pre>
  
  <p>and in .aspx page i am trying to access </p>
  
  <pre><code>$(this).attr("EmployeeId", Id);
  </code></pre>
  
  <p>getting the error The name </p>
  
  <pre><code>'Id' does not exist in the current context
  </code></pre>
  
  <p><strong>end update</strong></p>
  
  <p>i have two aspx pages:</p>
  
  <pre><code>1) employee.aspx
  2) employee_detail.aspx
  </code></pre>
  
  <p>how to pass an dynamic id from one page to another page</p>
  
  <p>the below code is in the <code>employee.aspx</code> page</p>
  
  <pre><code>//more code here..
  //but to relvant to my question is here...
  
  var submitButton = function()  {             
    //more code here...         
    if(employeeId != ""){   //redirecting here...
      window.location.href = "employee_detail.aspx"; 
   }    
  } 
  </code></pre>
  
  <p>so in <code>employee_detail.aspx</code> page i have a jquery function, currently i am hardcoding the id 
  something like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; 
  
  $(document).ready(function () { 
  
   var id = 'A42345'; //hardcoded.... 
  
  $(this).attr("EmployeeId", id);  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>so my question is, i am looking a way to pass an id from <code>employee.aspx</code> and receive in <code>employee_detail.aspx</code></p>
  
  <p>i thought of doing this but for security reason i dont want to expose the id in the url:</p>
  
  <pre><code>window.location.href = "mypage.aspx?id = " + id; 
  </code></pre>