Please please please tell me someone has gotten a CocoonJS game compiled through their website that can actually use AJAX to get data from a server?
This has become quite frustrating, especially since the AJAX commands work great when just using the CocoonJS app to play my game...
And yes, I have the cross domain setting in my php file on the server, it works great until it actually gets compiled through CocoonJS...
Develop games in your browser. Powerful, performant & highly capable.
If it doesn't work with cross domain settings, you should try with JSON-P
I'm not exactly sure what that means? I'm just using one of the basic functions of C2 that works perfectly fine with my php on a server through the browser, CocoonJS app launcher but refuses to work when it gets into their hands and they compile it.
There is no way that all of the games compiled through CocoonJS do not use any AJAX in their apps, or am I just being too hopeful here?
I use AJAX in one of my current projects, and it works completely fine in a game compiled through CJS and deployed to Google Play. It's in beta currently, so not public, but I've tested it with 20+ users on multiple networks and devices and it's been solid.
It's likely then that your issue is either in your events or server-side. What is the exact problem that you're having?
— I've tried to use AJAX via cocoonJS launcher and it worked because it depends on server side.
CocoonJS doesn't have own domain, so it's not allowed to get resources from other servers.
My php script should be:
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
echo 'Got it!';
If it doesn't work, depending on your server, let's try another solution:
It's basic JSON-P, it worked everything if we couldn't get cross-domain.