javascript - Uncaught error expression: Syntax error, unrecognized expression -


i trying place text file variable filedom have inside web application. right not parsing anything, storing data.

my html placeholder later use, follows:

<!doctype html> <html> <head> <link rel="stylesheet" type ="text/css" href="css/reader.css">     <title></title> </head> <body>  <script src="js/jquery-1.11.3.js"></script> <script src="js/reader.js"></script> </body> </html> 

my script is:

var html_file_url = 'http://localhost/feed.txt';  $(document).ready(function() {     $.get(html_file_url, function(data) {         var filedom = $(data);             console.log($(this).text());     }); }); 

i created xampp runs holds txt file , scripting file avoid technical request security measurements development.

anyway, syntax error doesn't recognize expression log shows:

uncaught error: syntax error, unrecognized expression 

all content in txt file, no quotes, string intended , line error points me api , line:

sizzle.error = function( msg ) {     throw new error( "syntax error, unrecognized expression: " + msg ); }; 

simple solution i'm sure, can't around parsing , storing lines file until (probably silly solution) figured out. help!

if want place data filedom, instead of this...

var filedom = $(data); 

do this:

var filedom = data; 

you cannot pass arbitrary strings $. $ function expects either selectors or html fragments.


Comments