Reputation: 401
I have the following jQuery below, I get an error with the "$.get(page+".php", function(html))" line. I'm using the latest jQuery version.
$(function() {
$("tabs a").click(function() {
$("#tabs li").removeClass("selected");
$(this).parent("li").addClass("selected");
var page = this.hash.substr(1);
$("#content").html("");
$.get(page+".php", function(html)) {
$("#content").html(html);
}
});
if(location.hash) ? $("a[href="+location.hash+"]").click() : $("#tabs a:first").click();
}
});
I'm following this tutorial: http://www.youtube.com/watch?v=nBbkTmQHh3M That guy doesn't get any errors. Dreamweaver highlights that line as there is a syntax error.
Thanks in advance.
Upvotes: 0
Views: 69
Reputation: 11749
This should be...
$.get(page+".php", function(html) {
$("#content").html(html);
}
});
Upvotes: 0
Reputation: 388316
Extra )
and }
$.get(page + ".php", function(html) { // <-- extra ) here
$("#content").html(html);
}); // <-- extra } here
Upvotes: 0
Reputation: 104775
You have some syntax errors:
$.get(page+".php", function(html)) { <-- extra )
$("#content").html(html);
} <--- missing );
Change to:
$.get(page+".php", function(html) {
$("#content").html(html);
});
Upvotes: 0
Reputation: 99620
You have a syntax error here:
$.get(page+".php", function(html)) {
// ^ This is extra
$("#content").html(html);
}
});
Should be
$.get(page+".php", function(html){
$("#content").html(html);
});
// } was extra
Upvotes: 2