GazEcc GazEcc - 6 months ago 8
Javascript Question

Can't load edits to my website

Im trying to get my gigs page to load content at the push of a button but it doesn't seem to be loading the content this is what i have

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$("#apr").click(function(){
$("#gigs").load(gigs/april13.html);
});
});
</script>
<title>Where We're Playing</title>
</head>


Where,
#apr
is the button id,
#gigs
is the id of the div where I want it to appear and
on the side I have an unordered list containing the button(s).
the file
gigs/april13.html
is the url of the gigs info.

This is the gigs page I'm talking about.

Answer

You forgot to include the jQuery API and also you have a typo mistake.

Try this instead:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function() {
            $("#apr").click(function(){
                $("#gigs").load('gigs/april13.html');
            }); 
        });
    </script>
    <title>Where We're Playing</title>
</head>