AJAX or alternative method in Cocoonjs ?

0 favourites
  • 7 posts
From the Asset Store
Template for an alternative to falling shapes, fully documented in comments and video
  • Hi,

    Is there currently any way of my app accessing a .php page ( on a seperatley hosted server so cross domain IS an issue ) , retrieving a variable and using this in my project.

    Compiling in Cocoonjs.

    I have tried and tried using varies snippets I found on the forums and failed.

    If anyone has managed this in any way ( even in a bit of a hodge-podge way ) then I would be so grateful if you could show me how or provide an example.

    For reasons I wont go into I dont want to use the clayIO sort of approach, as other things will be happening server side to change the variable(s)

    Thanks so much

    Danny

  • You are mostly out of luck in getting AJAX working with CocoonJS ( I tried several ways). You can try AppMobi plugin using "GET REMOTE DATA" action. Download the latest plugin github.com/koza/appMobiC2Plugin/tree/master/appmobidev so that u can tag the calls and listen for the tag of the event to occur.

  • Thanks for the reply. I did try that but also it didn't work. This was almost certainly me doing something wrong. I don't suppose you have an example I could look at

    Thanks again

    Danny

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, but it doesn't do anything.

    Sad day.

    Danny

    ps Can you confirm this works for you ?

  • Are you exporting to DirectCanvas or Phone Browser ? if phone browser then you don't have to do anything if DC,

    follow the instructions in the readme

    github.com/koza/appMobiC2Plugin/blob/master/README.md

    You will see a section at the bottom about including the directcanvasc2.js file in your index.html file.   If that file is not present the calls will not work under DC. So just make sure you include the directcanvasc2.js file in your bundle and paste the following ,

    <script src="directcanvasc2.js"></script>

    (under the appmobi.js script tags) in you index.html

    Note the Scirra will convert filenames to lower case if you add it in your file bundle (Files section in the project) . so use small case for all files that u refer in ur eventsheet or index.ml

    Let me know if it works , or provide with your capx. You don't have to be sad we are here to help :)

    <img src="smileys/smiley4.gif" border="0" align="middle" /> <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Thanks, I solved it.

    I simply defined the ID tag

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)