Link to home
Start Free TrialLog in
Avatar of kevp75
kevp75Flag for United States of America

asked on

Jquery $.get Error...

Having an issue with this little bit of code:
function loadPageSlide(strPageToLoad, strWhereToLoadIt) {
    $.get(strPageToLoad, function (data) {
        $(strWhereToLoadIt).html(data).slideDown(500);
    });
}

it is causing the following error: Node cannot be inserted at the specified point in the hierarchy

The page it is loading is very simple:
<div>
Hello World!
</div>
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Use :

function loadPageSlide(strPageToLoad, strWhereToLoadIt) {
    $.get(strPageToLoad, kevp75(strWhereToLoadIt));
}

var kevp75 = function(param1) {
      return function(data, param1) {
               $(param1).html(data).slideDown(500);
      }
}

Open in new window

If strWheretoload is an ID then try $("#"+strToLoad).load(strPageToLoad)
Avatar of kevp75

ASKER

@leakim971
now nothing shows, I then try to alert param1 to see what it is, and I get 'success', for data, I simply get [Object]

@mplungjan
strWheretoLoad is an ID, but I pass it in as #THEID already
Avatar of kevp75

ASKER

@mplungjan
.load does work, however, it does not do the slide effect that is required.
Did you add .slideDown(500) to the load?
Avatar of kevp75

ASKER

:)  yes
Update :

(don't forget to use the appropriate selector for strWhereToLoadIt, I mean a # for ID, a dot (.) for class and so on...)
var kevp75 = function(param1) {
    return function(data, textStatus, jqXHR) {
        $(param1).html(data).slideDown(500);
    }
}
    
function loadPageSlide(strPageToLoad, strWhereToLoadIt) {
    $.get(strPageToLoad, kevp75(strWhereToLoadIt));
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial