insert html content inside a class in jquery
I am using jquery to insert html content like,
$.get("_html/saveme.html", function(data){
$(".saveWin .modalCSS").html(data); //Error here
});
In Firefox it is giving me error as,
Node cannot be inserted at the specified point in the hierarchy
In IE it is working fine. Please suggest me, are there any other ways to call class inside a class and insert html content.
Thank开发者_开发问答s in advance
I cannot be sure what the issue is exactly coz I don't have enough details.
But I can tell you how to figure it out: Use Firebug. Add these statements in your Ajax callback:
console.log( $(".saveWin .modalCSS") );
console.log(data);
Check if $('.saveWin .modalCSS')
is turning up any results. See what the value of data
is.
Since it works in IE, there is something peculiar going on. Use Firebug to debug the problem.
Cheers :)
Okay, I just found the answer...
Instead of calling like,
$.get("_html/saveme.html", function(data){
$(".saveWin .modalCSS").html(data); //Error here
});
If I call,
$.ajax({
url: "_html/saveme.html",
type: "get",
dataType: "text",
success: function(data) {
$(".saveWin .modalCSS").html(data);
}
});
This works. Thanks a lot for your time guys.
精彩评论