Syntax error, unrecognized expression - but why?

Syntax error, unrecognized expression - but why?

Hi,

I've been going round and round in circles with this for the last hour, and its driving me up the wall :S

The code is:

  1.                 $.post('/cgi-bin/links/lead_contact_new.cgi', $('#contactForm').serialize() , function(data) {
  2.                     var errormsg = $(data).find('#error');
  3.                     console.log(errormsg);
  4.                     if (errormsg.length > 0) {
  5.                         console.log("Seems to be an errror:" + errormsg);
  6.                     } else {
  7.                         console.log("Looks ok");
  8.                     }
  9.                 });

The returned HTML is:

  1. <html><body><div id="error">Desolee, Adresse e-mail incorrect.Desolee, Entrez votre nom</div></body></html>

..yet it always fails at the find() with:

Error: Syntax error,             unrecognized expression: <html><body><div id="error">Desolee, Adresse e-mail incorrect.Desolee, Entrez votre nom</div></body></html>
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.min.js
Line 2

I've tried it using filter() as well, but to no avail with it either.

Anyone got any ideas?

TIA

Andy