SjoerdvdBelt SjoerdvdBelt - 25 days ago 15
Javascript Question

jQuery .get not working

I have the following code that I run whenever the

.information
element is clicked. I am trying to add the
aboutMe.html
document to the
#text
element when the
.information
is clicked:

$(".information").click( function() {
$.get("aboutMe.html"), function(data){
$("#text").html(data);
}});


For some reason the document is not added to the page when
.information
is clicked.

Answer

Your parentheses and braces are wrong. It should be:

$(".information").click( function() {
    $.get("aboutMe.html", function(data){
        $("#text").html(data);
    });
});

Your callback function was outside the argument list of $.get().

Comments