Languages

Menu
Sites
Language
HTML5 Game created with Construct 2

Hi,

I'm trying to load a json file that is located in the same place as the index.html but the AJAX request does not work.  My game works in chrome but stops the the web simulator.

Any ideas as to what I need to put in the config.xml file?

Many thanks in advance.

Simon

 

Responses

6 Replies
talari praveen kumar

Hi

Try this 

<pre class="code">

$.ajax({
        url: "Employee.json",
        dataType: "json",
        success: function(data1) {
             console.log("inside success");
             console.log(data1.data[0][0].Name);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.log('ERROR', textStatus, errorThrown);
        }
    });

</pre>

here is your Employee.json file

{"data":[[{"Id":"1","Name":"emp1"}],[{"Picture":"2","Name":"emp2"}]]}

Simon White

Hi

My game works in the chrome browser but not the web simulator.  In any case, I do not have access to change the javascript code as I am using Scirra Construct 2.

Is there something missing in the Config.xml file?

Simon

 

talari praveen kumar

Hi 

Did you add "*" in Policy->access of config.xml file????

Simon White

Hi

I have this element in my config.xml file:

<access origin="*" subdomains="true"/>

Is this correct?

Simon White

Hi 

The Tizen IDE tells me that the <access origin="*" subdomains="true"/> is malformed.

Thanks

Simon White

Hi,

 

I still haven't managed to resolve this issue.  I have worked around this problem for the time being by loading my json data via an object within my application.  It would be nice if I could find a proper solution.

Simon