stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
05/20/14 03:54 PM (10 years ago)

jQuery question in BT

I have an html file that uses jQuery. When I have the statement: <script src="http://code.jquery.com/jquery-1.11.1.js"></script> the app works as expected. However, if I download the jquery file (jquery-1.11.1.js) and place it in the BT-Docs folder and reference it with: <script src="jquery-1.11.1.js"></script> it doesn't work as expected. I don't understand why having the file locally should make any difference. Can someone explain? Thanks. Steve
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
05/20/14 05:12 PM (10 years ago)
If it is for Android try this: <script src="file:///android_asset/BT_Docs/jquery-1.11.1.js“></script>
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
05/20/14 05:22 PM (10 years ago)
No, it's IOS. Any suggestion for that?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/20/14 10:38 PM (10 years ago)
Make sure that the javascript file 'is' included in your 'Copy Bundle Resources' and 'not' included in 'compile sources'... If the javascript is compiled with other code, it won't work. Cheers! -- Smug
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/21/14 02:42 AM (10 years ago)
Smug is onthe money, here is a tip to make sure you add the resources correctly in the first place. When you drag files into a project, Xcode will popup a dialog to ask you how to handle it. In that popup dialog there is a radio button below the outline view with the option to either create groups or create folders for any added folder. As an example, I add my javascript in a folder called 'scripts' When adding that folder, I make sure that "create folders" is selected in the popup dialog. You'll know you've done it correctly as the folder for your script will show up as blue instead of yellow. This means the code in that folder will not be compiled. Hope that makes sense Alan
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
05/21/14 05:55 PM (10 years ago)
Smug, Just where are these Copy Bundle Resources folder and the Compile Resources one? Thanks Steve
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
05/21/14 06:23 PM (10 years ago)
Never mind found it, did it and all's well with the world. Thanks again
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/21/14 06:24 PM (10 years ago)
Keep this in your head... this is stuff you should know. https://dl.dropboxusercontent.com/u/115208762/bundlestuff.png Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.