언어 설정

Menu
Sites
Language
Parsing JSON

Hello

I have a probleme when i try to parse JSON prom php page with XHR 

this is my html page

<input name="myBtn" type="submit" value="Submit Data" onClick="javascript:ajax_post();">
<br />
<div id="status"></div>

JavaScript

function ajax_post(){

    var reviver;
    var hr = new XMLHttpRequest();
    document.getElementById("status").innerHTML = "processing...1";
    var url = "http://quotesconsommationesprit.azurewebsites.net/json/json.php";
    document.getElementById("status").innerHTML = "processing...2";
    hr.open("GET", url, true);
    
    document.getElementById("status").innerHTML = "processing...3";
    hr.setRequestHeader("Content-type", "script/json");
    
    document.getElementById("status").innerHTML = "processing...4";
    hr.onreadystatechange = function() {
        if(hr.readyState == 4 && hr.status == 200) {

            document.getElementById("status").innerHTML = "processing...7";
            var return_data = JSON.parse(  hr.responseText, reviver);
            document.getElementById("status").innerHTML = return_data.citation[0].id;
        }
    }
    document.getElementById("status").innerHTML = "processing...5";
    hr.send(null);
    document.getElementById("status").innerHTML = "processing...6";
    }

 when i run it with Tizen web Application and with Google Chrome, was stopped on "processing...6"

chrome  emulator  

but it work with the Tizen web Simulator application 

simulator 

and i added the access in the Policy 

where is the problem please 

Edited by: Mohamed Anis Mahjoubi on 23 4월, 2014

Responses

4 댓글
Marco Buettner

I tested it on RD-PQ (Tizen 2.2.1) and it works perfect :)

AVSukhov

Hello,

It's also working on Z9005 device.

Marco Buettner

I tested also on Tizen SDK emulator and it works also perfect... It needs some seconds, because I haven't no hw acc.

nguyen duy an

may be chrome blocked you access by SOP  by default, and on tizen you could when you added access.

Plz also try with adding <access origin="*" subdomains="true"></access> in config.xml

If you still want to access on chrome, you have to work around SOP like using proxy , or yahoo api...

thanks