title: JavaScript XMLHttpRequest using JsonP
body: <p>I want to send request parameters to other domain </p>
  
  <p>I already know that Cross Scripting needs JsonP and I have used JsonP with Jquery ajax</p>
  
  <p>but i do not figure out how to do Cross Scripting as using XMLHttpRequest </p>
  
  <p>following code my basic XMLHttpRequest code.</p>
  
  <p>i guess i need to chage <code>xhr.setRequestHeader()</code> and i have to add parsing code </p>
  
  <p>please give me any idea </p>
  
  <pre><code>var xhr;
  function createXMLHttpRequest(){    
      if(window.AtiveXObject){
          xhr = new ActiveXObject("Microsoft.XMLHTTP");
      }else{
          xhr = new XMLHttpRequest();
      }   
      var url = "http://www.helloword.com";   
  }
  
  function openRequest(){ 
      createXMLHttpRequest();
      xhr.onreadystatechange = getdata;
      xhr.open("POST",url,true);
      xhr.setRequestHeader("Content-Type",'application/x-www-form-urlencoded');
      xhr.send(data); 
  }
  
  function getdata(){
      if(xhr.readyState==4){
          if(xhr.status==200){
              var txt = xhr.responseText;
              alert(txt);
          }
      }   
  }
  </code></pre>