tags:

views:

25

answers:

0

I am not able to use the address plugin for the below code to work. Need help writting the js. Pls help.

Objective: click on each link, the <div id='load'> will be populated with corresponding data and this should be back button enabled.

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="myForm" runat="server">
    <div>
    Ajax load<br />
    <a href="#1" rel="history">load 1</a><br />
    <a href="#2" rel="history">load 2</a><br />
    <a href="#3" rel="history">load 3</a><br />

    <hr />
    Loaded html:<br />
    <div id="load">
    </div>      
    </div>
    </form>
</body>

<script src="JS/jquery.js" type="text/javascript"></script>
<script src="JS/jquery.address-1.2.1.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $("a[rel='history']").click(function() {
            $("#load").text($(this).text().substring(5));

            $.address.value($(this).attr('href'));
        });

        $.address.change(function(event) {
            // do something depending on the event.value property, e.g.
            $('#load').load(event.value);
        });
    });


</script>

</html>