Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
opzero
Posts: 7
Registered: ‎02-25-2011
My Device: Playbook (Simulator)
Accepted Solution

jQuery Playbook Issues

Hi,

 

From my understanding, jQuery is completely functional within the Playbook Simulator. However, I can't for the life of me get it to work.

 

I've included the jQuery JS file in my .bar package.

 

I have:

 

 

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        alert('Hello world!');
    });
</script>

 

The alert is never called. What am I doing wrong?

 

Also, is there any kind of console or logging available? I can only assume that this is throwing errors, but I have no idea where to find them.

 

Thanks,

Matt

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: jQuery Playbook Issues

It must be something else causing your app not to work right. My entire app is built on JQuery as a foundation library and I have not had any issues besides the XHR local file stuff not working right (which is a platform issue, not a JQuery issue).

 

Is JQuery actually getting loaded (file at the right location and all).

Does a simple <script>alert('Hello World!');</script> work?

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
New Contributor
opzero
Posts: 7
Registered: ‎02-25-2011
My Device: Playbook (Simulator)

Re: jQuery Playbook Issues

Moving the alert outside of the document.ready works, but everything inside of the document.ready won't run.

 

How can I find out if jQuery is loading properly? I'm assuming it's not since none of it's features are working. Is there a console or log I can peak at?

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: jQuery Playbook Issues

I don't think there's anything like that. Debugging on the simulator is a royal pain if you ask me. I have developed my entire app in Chrome and I simply try it out in the Simulator every time I finish a major new chunk of functionality. I haven't run into any real differences between Chrome vs. the Simulator so this has been working great for me.

 

For what it's worth, I'm loading all my JS at the bottom of the page like this:

 

 

<script type="text/javascript" src="x-javascript/jquery.js"></script>
<script type="text/javascript" src="x-javascript/alphabet.js"></script>
<script type="text/javascript" src="x-javascript/json.js"></script>
<script type="text/javascript" src="x-javascript/utils.js"></script>
<script type="text/javascript" src="x-javascript/animator.js"></script>
<script type="text/javascript" src="x-javascript/pagecontroller.js"></script>

 

 

JQuery comes first, everything else that uses it afterwards and I have no issues or whatsoever. Does your exact example work in Chrome? Sorry if it sounds stupid but I still think there must be something wrong with the package you're sending to the Simulator somehow.

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
New Contributor
opzero
Posts: 7
Registered: ‎02-25-2011
My Device: Playbook (Simulator)

Re: jQuery Playbook Issues

I've done all my devloping in Chrome as well, and it's working perfectly. For the time being I'm coding my JS all within the index.html page, but I don't see that being the cause of any problems.

 

Feel free to ask me all the "stupid" questions you can think of. I encourage it. I'm definitely making a very basic newbie mistake somewhere. I'll double check my package when I get home to make sure everything's being included properly.

 

Are you using $(document).ready() as well? I know there's 3 or 4 methods of waiting for jQuery and the DOM to be ready, I just want to take that possibilty out of the equation.

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: jQuery Playbook Issues

I was not using $(document).ready() (no need for me because with everything at the bottom I know everything is always ready by the time the code fires up) but for the sake of testing I put it around my pagecontroller code. It worked fine for me.

 

My suggestion:

 

Try putting script(s) at the bottom of the page and see if the rest of your code works fine

 

Also feel free to send me a zip with a showcase of this breakage and I'll be happy to take a look to see if I can figure out what is wrong :smileyhappy:

 

(marco@i-marco.nl)

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
New Contributor
opzero
Posts: 7
Registered: ‎02-25-2011
My Device: Playbook (Simulator)

Re: jQuery Playbook Issues

[ Edited ]

I tried moving the scripts around and still no go. I'm pretty sure jQuery isn't being loaded.

 

I've tried stripping the app down to absolutely nothing except the document.ready and the alert to test it out and I'm still not having any luck. So I think it's safe to say I'm making a really stupid mistake somewhere in the compile/deploy process.

 

I've uploaded my project files and the zip here:

 

MOD: Links removed at poster's request.

 

I'm compiling with:

 

"C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\bbwp.exe" app.zip /d /v

 

I'm deploying with:

 

 

"C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\blackberry-tablet-sdk\bin\blackberry-deploy" -password <password> -installApp -device 192.168.1.111 -package "bin\app.bar"

 

Any ideas?

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: jQuery Playbook Issues

Found the problem. It's a shocker too. I thought maybe there's something wrong with your JQuery JS file so I put mine in, not realizing at that time that I'm on 1.5 and you're on 1.5.1. JQuery 1.5.1 is totally broken on the PlayBook simulator. (!)  My app doesn't run on it either. Nothing happens.

 

Use 1.5 and everything is just fine.

 

I'll post a separate topic on this issue to let other developers know.

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
New Contributor
opzero
Posts: 7
Registered: ‎02-25-2011
My Device: Playbook (Simulator)

Re: jQuery Playbook Issues

You, sir, are amazing. That did the trick. Everything is working perfectly now.

 

Thanks, kudos, and whatever else I can give you.

Please use plain text.
Contributor
slondell
Posts: 33
Registered: ‎02-23-2011
My Device: PlayBook
My Carrier: Simulator

Re: jQuery Playbook Issues

[ Edited ]

:smileyhappy:  Oh thank-you for the help!

 

... and have some Kudos!

--------------------------------------
ABC Trace for BlackBerry PlayBook
Please use plain text.