View Single Post
Old 12-07-2012, 09:49 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
The response is returned as a string, rather than an HTML element. Try

Code:
var returnAsHTML = $(data);
// then..
if (returnAsHTML).find(...) // etc..
// do you need to use find..?
if ($(".error", returnAsHTML).length) {
Do you need to use each()? I suspect you just need to use first() to retrieve the first (and only) error message.

But if you return just a string rather than '<div>...etc.' then you can just use the string as is rather than extracting it.

I would consider returning either 'true' or 'Some error message' and check against the text 'true'.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote