AJAX or alternative method in Cocoonjs ?

Get help using Construct 2

Post » Wed Dec 19, 2012 8:31 am

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
B
4
Posts: 11
Reputation: 447

Post » Wed Dec 19, 2012 6:01 pm

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 https://github.com/koza/appMobiC2Plugin/tree/master/appmobidev so that u can tag the calls and listen for the tag of the event to occur.
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Thu Dec 20, 2012 10:42 am

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
B
4
Posts: 11
Reputation: 447

Post » Thu Dec 20, 2012 3:25 pm

Try this capx , https://dl.dropbox.com/u/80050021/TestAjax64.capx
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Thu Dec 20, 2012 6:04 pm

Thanks, but it doesn't do anything.

Sad day.

Danny

ps Can you confirm this works for you ?
B
4
Posts: 11
Reputation: 447

Post » Thu Dec 20, 2012 8:09 pm

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

https://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 :)
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Sun Jan 13, 2013 7:26 pm

Thanks, I solved it.
I simply defined the ID tag
B
16
S
3
G
2
Posts: 1
Reputation: 2,368


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer and 29 guests