I have a HTML5 game working perfectly in desktop and for the leadersboards (and for more stuff) I use ajax to send parameters and receive data.
The fact is that everything is working fine but in cocoon, in cocoonjs is not working at all and I don´t know why, jQuery is supported and in theory everything should be fine. Does anyone know why is not working this code?
Thanks in advance.
$.ajax({
type: 'GET',
url: this.baseURL+'/getScores.php',
data: {
'theGame': '1',
'theOrder': 'ASC'
},
fail: function(msg){
alert(msg);
}
});
And I´m also trying this code (not working in cocoonjs)
$.getJSON( STK.root.urlBase+"/getScores.php",
{ theGame: "1", theOrder: "ASC" }
)
.done(function(data) {
//DO STUFF
})
.fail(function( jqxhr, textStatus, error ) {
console.log( "Request failed: " + err );
});
Well, everything was a CORS thing, I fixed it with this header in the php files that receive/send data: