Logo for page: jQuery-tutorials
jQuery Tutorials
 
Last updated: Thu, 18-Sep-2014
 
*
*
References:
JavaScript: The Good Parts (i.e. a slim volume)
Douglas Crockford
O'Reilly

jQuery Cookbook
jQuery Community Experts
O'Reilly

jQuery UI
Eric Sarrion
O'Reilly
*
URLs:
*
2013-04-11: Here's an error message from Chrome:
Uncaught ReferenceError: HASH is not defined
And here's the context in which I got it:
o I'm using jQuery.

o I displayed a list of notes with each one having a Delete and Update link.
This list is in a div within a CGI form.

o The Delete link looked like this:
                
Figure 1
Note: The $$row{id} syntax is Perl, which interpolates the value of $$row{id} into
the onClick string at run-time, i.e. when the Delete link HTML is generated as a
response to an Ajax call.

The Javascript function delete_person_note(id) is defined globally.

And yes, the '#' in that link is the '#' referred to in the error message.
The solution below will make it clearer.

o Elsewhere in the CGI form I had code to add a note.

o Immediately after displaying all existing notes, I could delete any number of them,
one at a time, by clicking on the corresponding Delete link.

o However, after adding a note, the list of notes was updated by being returned from
the Ajax call which added the new note to the database.

This includes regenerating the list of Delete and Update links (on the server) and using
jQuery to empty() the div holding the list, and calling append(html) with the new list.

o The solution:

Part 1: At the bottom of the form, I now have:
                
Figure 2
Part 2: The Delete link now says:
                
Figure 3
o So, the href now refers to a target which is defined. Since it is defined close to the
div being updated, the browser does not follow the link, but just updates the list of notes
as returned from the server.

o Put away those 2 asprin; You don't need them now...

o Lastly, here's the command to convert HTML into an image. Of course, you first have to put
the HTML into 1.txt.
                
Figure 4
*
        You can redistribute all my programs, and/or modify them, under the terms of
        The Artistic License 2.0, a copy of which is available via:
        https://www.gnu.org/licenses/license-list.html
*
 
Privacy Policy
"Copyright: © 1998 to 2014 Ron Savage"
Email address
Last updated: Thu, 18-Sep-2014
You can donate to me via GitTip
Top