title: How can I set a variable in my pages javascript based on my controller action in ASP.NET MVC?
body: <p>So, I have a page that looks like the following:
  <a href="http://img704.imageshack.us/img704/5973/croppercapture3.png" rel="nofollow noreferrer">alt text http://img704.imageshack.us/img704/5973/croppercapture3.png</a></p>
  
  <p>This is my basic messaging inbox.  I have 2 pages right now, Inbox and Sent (there will eventually be others).  These both share the same View, and just have 2 different actions to populate the appropriate data.</p>
  
  <p>The elements on the right-hand side (the message list) is a partial view which has its data populated based on my two controller actions Inbox(int? page) and Sent(int? Page).</p>
  
  <p>So, I have one view "MessageView" and one partial view "MessageList" shared between Inbox/Sent.</p>
  
  <p>However, I now have to get those arrow buttons ("&lt;" ">") working using Ajax.  I know how to use jQueries ajax calls well enough, and I know how to render the result of the action call (which returns a partial view). </p>
  
  <p>The problem comes from the fact that the javascript that makes these pagination ajax calls needs to know two things:</p>
  
  <ul>
  <li>What the current page is (whether it be /messages/inbox or /messages/sent)</li>
  <li>What the current page is (specified in the query string, ie /messages/inbox?page=2).</li>
  </ul>
  
  <p>Without knowing which page I'm on (Inbox or Sent), it wont know which url to make the ajax call on.  Should it make the postback to /messages/inbox or to /messages/sent?  </p>
  
  <p>If I wasn't making these messages load with Ajax it would be as simple as loading the appropriate url into the link tags for the "&lt;" and the ">" buttons.  But I can't, because part of my requirements states that it must load the messages below without visibly refreshing to a new page.</p>