HTML and CSS Reference
In-Depth Information
Progressive Enhancement With jQuery
The first step in making our blog commenting system feel less like a Web page and more like
an application is to stop page reloads when a user submits a comment. We can do this by
submitting the comments to the server using an AJAX request. Since jQuery is probably the
defacto standard for cross browser JavaScript functionality we'll use it here. Although I'm using
jQuery here, I'd also like to highlight that it's a good idea to
not always use jQuery
.
Instead,
13
analyze your scenario and make a considered decision because there are
some cases
14
where you are best not to.
In an attempt to try and keep as much scripting (PHP and JavaScript) from the
index.php
file
we'll create a new folder for our JavaScript and in there a file for our application JavaScript.
The path to this fill should be
js/app.js
. This file should be included after the jQuery include.
<
script
src
="
http://code.jquery.com/jquery-1.7.1.min.js
"></
script
>
<
script
src
="
js/app.js
"></
script
>