title: redirect with javascript to another domain with Json
body: <p>I'm retrieving an url from a php file with Json , and then in the success part I do </p>
  
  <pre><code>window.location=msg.message
  </code></pre>
  
  <p>but the proble is that if we suppose my domain is http example.com and the 
  <code>msg.message</code> value is </p>
  
  <pre><code>https://otherdomain.com
  </code></pre>
  
  <p>the redirection is done to http:/example.com/https:/otherdomain.com
  how can I go directly to https:/otherdomain.com
  code </p>
  
  <pre><code>     $.ajax({
     type: "POST",
     url: "ajax.php",
     data: dataString,
     dataType: "json",
     success: function (msg){
          $.fn.colorbox.close();//close the box
          alert(decodeURI(msg.message));//
          window.location.href(msg.message); // goes to domain.com/msg.message        
        },
     });
  </code></pre>