How to call a jquery function from a button in a project?

For developers using the Construct 2 Javascript SDK

Post » Sun Mar 09, 2014 7:58 pm

Hello, I'm trying to use jquery to print only the "c2canvas" <div> or to save it as a PDF. I know, via Stackoverflow that is posible to do so with jquery. But...How to call these functions from Construct? Is that flexible this framework to allow this?
B
17
S
4
G
1
Posts: 105
Reputation: 1,874

Post » Sun Mar 09, 2014 11:55 pm

You can run any javascript code in the Javascript SDK, so if it is possible in a web page, then you can write a plugin for Construct 2 that can do the same.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,228

Post » Mon Mar 10, 2014 2:39 pm

Ashley wrote:You can run any javascript code in the Javascript SDK, so if it is possible in a web page, then you can write a plugin for Construct 2 that can do the same.


Do you think I can do this with javascript sdk?

http://stackoverflow.com/questions/1729 ... javascript
B
17
S
4
G
1
Posts: 105
Reputation: 1,874

Post » Wed Mar 12, 2014 1:49 am

Yes, I think so!

Ashley DID say "any" after all. It'd be easier to ask "What can I NOT do", because every post I've ever seen has ended with "Yes, you can", especially when it comes to JavaScript stuff.
B
11
S
2
G
1
Posts: 172
Reputation: 1,486

Post » Tue Apr 22, 2014 5:50 pm

Well actually I did it, but with a kind of bypass:

I wrote a js file with my scripts. Then I created a project and created a call to a function where all my scripts are developed.

Then, I edited the resulting index.html in order to include there the js file where my function is.

And that's all!

It works for my aim, which was just to employ the jsPDF.js library to create a PDF form presenting data from my construct app.

Cheers!
B
17
S
4
G
1
Posts: 105
Reputation: 1,874


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests