XMLHttpRequest RRS feed

  • Question

  • Hello, 

    I'm trying to load a URI into a div. 

    I'm using XMLHttpRequest (the code is below).
    onreadystatechange event always get the value "1" and the site isn't loaded.

    Is XMLHttpRequest supported ?  

    thanks Liran.


    function loadpage(){

            if (window.XMLHttpRequest){
                // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
                // code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

                if (xmlhttp.readyState==4 && xmlhttp.status==200){

            xmlhttp.open("POST", "http://www.ynet.co.il", true);

    Saturday, May 18, 2013 7:54 PM


  • 1. ActiveX objects are not supported by apps for office.

    2. I assume this is a cross domain call. I suggest you use jquery library to make your ajax calls easier. Look at the documentation of jquery ajax call. For a cross domain call you have 2 options:

    • use dataType = "jsonp" parameter in ajax call and add jsonp support to web service code
    • or add CORS support to web service and use CORS capable browsers

    Anze Javornik

    Monday, May 20, 2013 9:37 PM