user2722718
user2722718

Reputation: 173

jQuery - load a page through jQ

I wanna know why this doesn't work anymore... it worked before, and I cant see whats wrong...

I want to load a page in class container2 through this script when clicking an a href link with the class changePage.

$(document).ready(function () {

        $(".changePage").click(function () {

            $(".container2").fadeOut("slow", function () {
                $(this).load(href, function (responseText, status, req) {
                    if (status != "error") $(this).slideDown("slow");
                });
            });

            return false;

        });

    });

Upvotes: 0

Views: 272

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

I think you want:

$(document).ready(function () {

    $(".changePage").click(function () {
        var href = this.href; //<< define href here
        $(".container2").fadeOut("slow", function () {
            $(this).load(href, function (responseText, status, req) {
                if (status != "error") $(this).slideDown("slow");
            });
        });

        return false;

    });
});

Upvotes: 1

Related Questions