title: web2py ajax call fails from pages other than index
body: <p>I am using the web2py ajax function, like this:</p>
  
  <p>In index.html</p>
  
  <pre><code>{{=INPUT(_name='total_buy', _onkeyup=
    "ajax('key',['total_buy'], ':eval')")}}
  
  &lt;div id="target"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and in default.py</p>
  
  <pre><code>def key():
  return "jQuery('#target').html('%s');" % repr(float(request.vars.total_buy))
  </code></pre>
  
  <p>This works perfectly.  When a number is typed into the input field, it is immediatly echoed to the target div.</p>
  
  <p>However, when I copy this to another page it stops working.  I do not see the input number being echoed.</p>
  
  <p>For example, I move the code from index.html to plan.html and leave everything else untouched, I continue to see the echo in the index page, but not in the new plan page.</p>
  
  <p>Taking a look at the server log, I see this:</p>
  
  <pre><code>127.0.0.1, 2011-10-15 13:55:50, POST, /medaim/default/key, HTTP/1.1, 200, 0.047000
  127.0.0.1, 2011-10-15 13:55:52, POST, /medaim/default/key, HTTP/1.1, 200, 0.047000
  127.0.0.1, 2011-10-15 13:55:52, POST, /medaim/default/key, HTTP/1.1, 200, 0.078000
  127.0.0.1, 2011-10-15 13:55:59, GET, /medaim/default/plan/1, HTTP/1.1, 200, 0.094000
  127.0.0.1, 2011-10-15 13:56:01, POST, /medaim/default/plan/key, HTTP/1.1, 500, 0.250000
  127.0.0.1, 2011-10-15 13:56:01, POST, /medaim/default/plan/key, HTTP/1.1, 500, 0.218000
  127.0.0.1, 2011-10-15 13:56:02, POST, /medaim/default/plan/key, HTTP/1.1, 500, 0.265000
  </code></pre>
  
  <p>It seems like, from the plan page, it is calling /medaim/default/plan/key rather than /medaim/default/key</p>
  
  <p>How do I deal with this?</p>