title: How to make a cross domain http get request using javascript?
body: <p>I'm trying to implement sms functionality in Dynamics CRM 2011. I've created a custom activity for this and added a button to the form of an SMS. When hitting the button, a sms should be send. </p>
  
  <p>I need to make an http request for this and pass a few parameters. Here's the code triggered:</p>
  
  <pre><code>function send() {
  var mygetrequest = new ajaxRequest()
  mygetrequest.onreadystatechange = function () {
      if (mygetrequest.readyState == 4) {
          if (mygetrequest.status == 200 || window.location.href.indexOf("http") == -1) {
              //document.getElementById("result").innerHTML = mygetrequest.responseText
              alert(mygetrequest.responseText);
          }
          else {
              alert("An error has occured making the request")
          }
      }
  }
  var nichandle = "MT-1234";
  var hash = "md5";
  var passphrase = "[encryptedpassphrase]";
  var number = "32497123456";
  var content = "testing sms service";
  
  mygetrequest.open("GET", "http://api.smsaction.be/push/?nichandle=" + nichandle + "&amp;hash=" + hash + "&amp;passphrase=" + passphrase + "&amp;number=" + number + "&amp;content=" + content, true)
  mygetrequest.send(null)
  }
  
  function ajaxRequest() {
      var activexmodes = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
      if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
          for (var i = 0; i &lt; activexmodes.length; i++) {
              try {
                  return new ActiveXObject(activexmodes[i])
              }
              catch (e) {
                  //suppress error
              }
          }
      }
      else if (window.XMLHttpRequest) // if Mozilla, Safari etc
          return new XMLHttpRequest()
      else
          return false
  }
  </code></pre>
  
  <p>I get the "access is denied error"  on line:</p>
  
  <pre><code>mygetrequest.open("GET", "http://api.smsaction.be/push/?nichandle=" ......
  </code></pre>
  
  <p>Any help is appreciated.</p>