In order to use jQuery, do I have to use the following reference in my html?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
What if my server does not have an internet connection?
Use this code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">window.jQuery || document.write('<script src="/res/jQuery/jquery-1.7.1.min.js"> \x3C/script>');</script>
This will try to download from the CDN, or otherwise use the local one. You must download the local one first though.
It is not specifically for this case, but I think you should definitely understand how Client-server works. Also, you should understand what is Client-side scripting.
You would then understand that you (your browser) need to be connected to Internet in order to be able to reach the http://ajax.googleapis.com domain.
If you want to work with it locally, without ever reaching Internet, then download jQuery locally, and refer to it in your script tag.
Download the latest jquery file:
http://code.jquery.com/jquery-1.7.1.min.js
And save it to you project. It will now be available locally so you can reference it like this (only an example):
<script src="/path-to-your-jquery-file.js"></script>
It does not matter if your server has or has not connection to internet. Only the browser which tries to access page from said server need connection to internet. Server just needs to be "visible" from this browser in question.
It might be better, if you understood the basics of how internet works, before you start playing in developers.
what if my server does not have an internet connection?How are you connecting to it if it doesn't have a internet connection? And besides, it's the client which requests that file from the Google CDN, not the server.localhost, I'd imagine.