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>
LVL 25
kevp75Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
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

0
Michel PlungjanIT ExpertCommented:
If strWheretoload is an ID then try $("#"+strToLoad).load(strPageToLoad)
0
kevp75Author Commented:
@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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

kevp75Author Commented:
@mplungjan
.load does work, however, it does not do the slide effect that is required.
0
Michel PlungjanIT ExpertCommented:
Did you add .slideDown(500) to the load?
0
kevp75Author Commented:
:)  yes
0
leakim971PluritechnicianCommented:
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

0
Michel PlungjanIT ExpertCommented:
var content = $('<html/>').load(strPageToLoad);
$('#'+strWhereToLoad).html(content.html()).slideDown(500);
content.remove();
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.