Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Actually using jQuery?
New Posts  All Forums:Forum Nav:

Actually using jQuery?

post #1 of 50
Thread Starter 
Is this built into decently modern browsers? Do I need to download a database to actually use the functions? Because I have finished up Codecademy's (extremely tedious) jQuery lessons, went back, copied and pasted EXACTLY what was given in one, saved all three files (.html, .css, and .js) as EXACTLY the same file with EXACTLY the same extensions in the same folder. Load up the HTML file and... absolutely nothing. Standard Javascript works fine when linked from an external file but jQuery refuses to work.
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
post #2 of 50
If you don't insert any script link to Jquery you'll have an error like this : $ is not recognized.

Include this in all the pages :
Code:
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

I would put it in a header template this way you won't be able to forget to import the library !

Once you have included the script, declare your first jquery function to see if it works :
Code:
$( document ).ready(function() {
    alert('Page loaded successfully');
});
post #3 of 50
If you need any help for jQuery, I've been using it for a while now and I understand it fairly well smile.gif
post #4 of 50
Thread Starter 
Also of note, the link to jQuery in the header needs to be downloaded before whatever custom scripts. For me, that would be:
Code:
<link rel='stylesheet' type='text/css' href='style.css'/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type='text/javascript' src='engine.js'></script>

I suppose it doesn't really matter where the CSS link goes. Thanks, that's so obvious that I think I should be ashamed.
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
post #5 of 50
Quote:
Originally Posted by CynicalUnicorn View Post

Also of note, the link to jQuery in the header needs to be downloaded before whatever custom scripts. For me, that would be:
Code:
<link rel='stylesheet' type='text/css' href='style.css'/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type='text/javascript' src='engine.js'></script>

I suppose it doesn't really matter where the CSS link goes. Thanks, that's so obvious that I think I should be ashamed.

Don't be ashamed, it happens to everyone tongue.gif

Right now you'll be using the code on jquery's server, if you want to be failproof you could always download the file and host it on your server, this way if jquery servers goes down (why would it go down anyway ?) you'll be safe. Also you could potentialy gain some loading speed.
post #6 of 50
Quote:
Originally Posted by CynicalUnicorn View Post

Also of note, the link to jQuery in the header needs to be downloaded before whatever custom scripts. For me, that would be:
Code:
<link rel='stylesheet' type='text/css' href='style.css'/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type='text/javascript' src='engine.js'></script>

I suppose it doesn't really matter where the CSS link goes. Thanks, that's so obvious that I think I should be ashamed.

Yep, i remember doing that mistake when i was starting out with web development and took me an hour to figure out why a certain script wouldn't work. tongue.gif
Haswell
(21 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 4770K @ 4Ghz Gigabyte Z87X-UD5H Sapphire Radeon R9 290 Vapor-X G.Skill RipjawsZ 4x4GB 2400Mhz 
Hard DriveHard DriveHard DriveHard Drive
Crucial M4 126GB Crucial MX100 4x512GB WD Caviar Green EZRX Crucial M500 120GB 
Optical DriveCoolingOSMonitor
Samsung DVD Corsair Hydro H105 Windows 7 Ultimate Acer B276HK 
MonitorMonitorKeyboardPower
Dell P2314H Samsung SA700 Logitech G710+ Seasonic P-660 XP2 
CaseMouseMouse PadAudio
Fractal Design Arc Midi R2 Razer Deathadder 2013 Mionix Sargas 900 Asus Xonar DX/XD 
Audio
Beyerdynamics Custome One Pro White 
  hide details  
Reply
Haswell
(21 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 4770K @ 4Ghz Gigabyte Z87X-UD5H Sapphire Radeon R9 290 Vapor-X G.Skill RipjawsZ 4x4GB 2400Mhz 
Hard DriveHard DriveHard DriveHard Drive
Crucial M4 126GB Crucial MX100 4x512GB WD Caviar Green EZRX Crucial M500 120GB 
Optical DriveCoolingOSMonitor
Samsung DVD Corsair Hydro H105 Windows 7 Ultimate Acer B276HK 
MonitorMonitorKeyboardPower
Dell P2314H Samsung SA700 Logitech G710+ Seasonic P-660 XP2 
CaseMouseMouse PadAudio
Fractal Design Arc Midi R2 Razer Deathadder 2013 Mionix Sargas 900 Asus Xonar DX/XD 
Audio
Beyerdynamics Custome One Pro White 
  hide details  
Reply
post #7 of 50
Quote:
Originally Posted by Jiiks View Post

Yep, i remember doing that mistake when i was starting out with web development and took me an hour to figure out why a certain script wouldn't work. tongue.gif

Many times in programmation you end up against a wall and it seems impossible to bypass, but in the end you always find a way and you are happy smile.gif
haha
post #8 of 50
Quote:
Originally Posted by Abs.exe View Post

Don't be ashamed, it happens to everyone tongue.gif

Right now you'll be using the code on jquery's server, if you want to be failproof you could always download the file and host it on your server, this way if jquery servers goes down (why would it go down anyway ?) you'll be safe. Also you could potentialy gain some loading speed.

Since lots of sites use the main jQuery files, I would assume that most browsers cache that file which should lead to better performance if you also link there.
post #9 of 50
Quote:
Originally Posted by Abs.exe View Post

Don't be ashamed, it happens to everyone tongue.gif

Right now you'll be using the code on jquery's server, if you want to be failproof you could always download the file and host it on your server, this way if jquery servers goes down (why would it go down anyway ?) you'll be safe. Also you could potentialy gain some loading speed.

It sounds like your new to javascript. Dont worry about making stuff efficient right now, it will just make things more complicated for you. When i first started to get into javascript I started to do the same thing. I found a more efficient way of writing a for loop , so i started to do that, but when i was looking trough my code, i always had a hard time reading it. I ended up going back to the easier slower way, but in actuality, the time difference between the two probably saved me 2 milliseconds. For my simple prototype webpage, not a problem. If this was production and was going to have 1 million people running it... that 2ms is worth changing then.

It is very unlikely that the jQuery's servers will go down. So, right now its not worth worrying about. If its imperative that the code need 99.9999999% uptime, then it would be a good time to read up on caching.
Zev's Comp
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-2500K Sandy Bridge 3.3GHz GIGABYTE GA-Z68X-UD3H-B3 LGA 1155 Intel Z68 HDM... GeForce GTX 750 Ti G.SKILL Ripjaws X Series 8GB 
Hard DriveHard DriveHard DrivePower
1TB HDD 64GB SSD (Used for SRT) 500 GB. Antec BP550 Plus 550W Continuous Power ATX12V V... 
Case
COOLER MASTER ELITE 335 RC-335-KKN1-GP Black S... 
  hide details  
Reply
Zev's Comp
(15 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5-2500K Sandy Bridge 3.3GHz GIGABYTE GA-Z68X-UD3H-B3 LGA 1155 Intel Z68 HDM... GeForce GTX 750 Ti G.SKILL Ripjaws X Series 8GB 
Hard DriveHard DriveHard DrivePower
1TB HDD 64GB SSD (Used for SRT) 500 GB. Antec BP550 Plus 550W Continuous Power ATX12V V... 
Case
COOLER MASTER ELITE 335 RC-335-KKN1-GP Black S... 
  hide details  
Reply
post #10 of 50
Thread Starter 
Since I'm not actually publishing this (yet, I need to register my real name as a domain so I can have [me]@[me].com as an email address) I've just saved a copy of the API on my scratch disk. It's much easier to edit like that. Actually making the code work comes first. Optimization comes later.
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
Triumvirate
(20 items)
 
Osmium
(8 items)
 
For Sale: [FS] Z97 system: Xeon and RAM
$160 (USD) or best offer
CPUMotherboardGraphicsGraphics
i7-5775C ASUS Sabertooth Z97 Mark 2 Sapphire RX 480 (reference) MSI Low-Profile 750Ti 
RAMHard DriveHard DriveHard Drive
Corsair Dominator Platinum - 2x8GB Crucial M500 - 960GB Samsung 840 - 250GB WD Scorpio Blue - 1TB 
Hard DriveCoolingCoolingOS
ADATA SP900 - 64GB Scythe BIG Shuriken 2 Rev. B PNY Quadro 600 blower Windows 10 
MonitorMonitorMonitorKeyboard
ASUS VE247H - 1080p Gateway FPD1960 - 1280x1024 Samsung S20D300 - 900p, portrait Rosewill RK9000I - Cherry MX Blue 
PowerCaseMouseOther
Rosewill HIVE 650W Riotoro CR1080 SteelSeries Rival 100 CyberPower 1500PFCLCD 
CPUMotherboardRAMHard Drive
AMD A10-7870K ASRock FM2A88X-ITX+ G.Skill Ripjaws X - 2x4GB @ 2400MT/s Samsung 840 120GB 
CoolingOSPowerCase
Evercool EC-HPS-810CP Windows 7 Pro 64-bit PicoPSU-120-WI-25 Mini-Box M350 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Actually using jQuery?