• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

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>
0
kevp75
Asked:
kevp75
  • 3
  • 3
  • 2
1 Solution
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now