How to use JQuery SDK for cocoon?

For developers using the Construct 2 Javascript SDK

Post » Sat Nov 16, 2013 2:44 pm


Hi I am making a plugin for requesting a set of questions that are on a web service.

i have a Jquery.ajax() function in my plugin and it works good on preview mode, but when I publish to Cocoon it shows that JQuery is not defined.

can some one help me. thanks
B
9
S
4
Posts: 49
Reputation: 1,239

Post » Sat Nov 16, 2013 3:05 pm

searching a bit more i found that:

"Note jQuery is not included with non-browser platforms, which include CocoonJS and directCanvas." https://www.scirra.com/manual/22/runtime-overview

what should i do?
B
9
S
4
Posts: 49
Reputation: 1,239

Post » Sat Nov 16, 2013 8:43 pm

Use AJAX plugin for ajax?

see here

If the response is JSON you can use HashTable to decode it into a key-value objecttlarkworthy2013-11-16 20:44:48
B
14
S
5
G
1
Posts: 60
Reputation: 1,052

Post » Sat Nov 16, 2013 10:05 pm

As you've found, CocoonJS is not a real browser so jQuery does not work.

If all you're doing is making an AJAX request, there's no need to use jQuery anyway - just create an XMLHttpRequest object directly.
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest