title: Passing URL parameter to a page in javascript and php
body: <p>I need help, This is what am actually trying to do. I have two files. "index.php" and "realtime.php" the index.php displays news from a particular country base on the url parameter "country_code", and the realtime.php updates the news list every 2 seconds. what I want is for realtime.php to get the current url parameter of index.php so that it can only update news from that particular country base on the url parameter. I really need this help. Thank you again. </p>
  
  <p>script for index.php</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
  $.arte({'ajax_url': '../realtime.php?lastid='+$('.postitem:first').attr('id'), 'on_success': update_field, 'time': 1000}).start();
  function update_field(data)
  {
      $("#realtimeupdate").html(data);
  }
  });
  </code></pre>
  
  <p></p>
  
  <p>And the script  for realtime.php</p>
  
  <pre><code>&lt;?php
  
  include"customDB.php";
  $lastid = $_REQUEST['lastid'];
  $query = 'SELECT count(*) as newpost FROM wp_posts WHERE country_code = "XXXXX" AND    post_id &gt; "'.$lastid.'"';
  $result = mysql_query($query);
  $rec = mysql_fetch_object($result);
  if($rec-&gt;newpost){ ?&gt;
  &lt;a href="" id="newpostlink"&gt;(&lt;?php echo $rec-&gt;newpost; ?&gt;) new posts&lt;/a&gt;
  &lt;script type="text/javascript"&gt;document.title = '(&lt;?php echo $rec-&gt;newpost; ?&gt;) new  posts'&lt;/script&gt;
  &lt;?php } ?&gt;
  </code></pre>