title: Get variables in c# from ajax call
body: <p>I've got an Ajax call for log in here is the code:</p>
  
  <pre><code>//if MOUSE class is clicked
  $('.mouse').click(function () {
      //get the form to submit and return a message
      //how to call the function 
  
      var name = $('#name').val();
      var pwd2 = $('#pwd2').val();
      $.ajax({
      type:"POST",               
       url: "http://localhost:51870/code/Login.aspx",
       data: "{ 'name':'" + $('#name').val() + "', 'pwd':'" + $('#pwd2').val() + "' }",
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       context: document.body, 
       success: function () {
          //$(this).addClass("done");
          $(this).hide();
           $('.mouse, .window').hide();
                           }
  });
  
  });
  </code></pre>
  
  <p>the problem is I can't seem to catch name and pwd variables in Login page's preinit event or page load event here is the code in c#:</p>
  
  <pre><code> protected void Page_PreInit(object sender, EventArgs e)
  {
      //taking javascript argument in preinit event
      //from here I'll have to build the page for specific lookbook
      var name = Request.QueryString["name"];
      var pwd = Request.QueryString["pwd"];
  
  }
  
  protected void Page_Load(object sender, EventArgs e)
  {
      var name = Request.QueryString["name"];
      var pwd = Request.QueryString["pwd"];
      SignIn(name);
  }
  </code></pre>
  
  <p>I can't seem to get username name and password in c# side, help is appreciated.</p>
  
  <blockquote>
    <p><strong>Here is my final javascript code c# code remains the same:</strong></p>
  </blockquote>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
          $(document).ready(function () {    
   //if MOUSE class is clicked
              $('.mouse').click(function () {
  
                  var name = $('#name').val();
                  var pwd = $('#pwd').val();
                  $.ajax({
                 url: "http://localhost:51870/code/Login.aspx?name="+ name +"&amp;pwd="+pwd,
                 context: document.body, 
                 success: function () {
                      //$(this).addClass("done");
                      $(this).hide();
                       $('.mouse, .window').hide();
                                       }
              });
  
              });
  
       });
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks Zachary</p>