1

I am using an MVC framework and I am making ajax request to an action and the response data is an html page, which is something like that:

<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" class="no-js ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html lang="en" class="no-js ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html lang="en" class="no-js ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang='en' ng-app="gd">
    <head>
    </head>
    <body>
    </body>
</html> 

But the problem comes when I try to select something from that html- an "Uncaught Error: Syntax error, unrecognized expression: and here is the whole html" error occur. I searched the web for some solution and what I found was that jQuery 1.9 recognize html strings only if they start with html tag and if there are any whitespaces the above error occur. I try to use the $.parseHtml() function, but still there is no change. Does anybody have any solution for that problem?

Ok, here is my script:

success : function(data) {
                        $(data).find(".goalSection").each(function() {
                            $("goalsSection:last").append($(this));
                        });
                        start = start+5;
                    }

This is what happens on ajax request success.

Hristo Angelov
  • 1,019
  • 1
  • 15
  • 34

0 Answers0