title: With JavaScript Ajax polling for widget
body: <p>I have the follow problem. I need to create a JS widget and set it on one blog, for example any blog from blogger.com. YOu can select there a box for javascript and I will post the JS in this box.</p>
  
  <p>The problem what I have and don't know how to do this is, that the script should do an ajax polling for exmaple for 60 seconds. But how to execute an ajax call, when the host is not the same linke the host, where the JS is includet?</p>
  
  <p>For example the easiest way to explai is: There is a search box and when enayone searches for anythign, then the JS script should streaming the results for 60 seconds from the server what I have set in the script and is different as the host, where the JS is includet, without to become a problem with the JS restriction for hosts.</p>
  
  <p>Or for example a chat client, where the client is hosted on one other host and the server on another.</p>
  
  <p>Can anyone tell me an idea, or send me an example how to do this?</p>
  
  <p>Thanks
  Nik</p>
  
  <hr>
  
  <p>Well with this example is it possible but without JSONP?</p>
  
  <pre><code>function asyncreq(url) {
   var xmlhttp = false;
     try {
       xmlhttp = new XMLHttpRequest();
     } catch (trymicrosoft) {
       try {
         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (othermicrosoft) {
         try {
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (failed) {
           xmlhttp = false;
         }  
       }
     }
   if (xmlhttp){
           try {
               xmlhttp.open("GET", url);
               xmlhttp.onreadystatechange=function() {
                  document.getElementById('mydiv').innerHTML = xmlhttp.responseText;
               }
  
               xmlhttp.send(null);
           }
           catch (failed) {
       xmlhttp = false;
     }
   }
  }
  </code></pre>
  
  <p>If you send the response in chunks, then everything is fine. But here is the call in ajax again. And when I use it in a different host, then I can't call the url because of the same-origin policy.</p>
  
  <p>Is there another way?</p>
  
  <p>I found a very interesting example <a href="http://www.cvskolan.se/" rel="nofollow">here</a>.</p>
  
  <p>Take a look at the bottom, there is a job search box. If you investigate a litte bit, then you will see there is a usage of a class RSL() which is doing the request. How this class is doing the request without ajax? I can't understand wow this class works. Can anyone show me a better example?</p>