@Michael Andy
You gents where correct, it was adding a newline to return data.
console.log( '[' + data + ']' );
showed the correct data being returned. After looking at my php
script I did have a few blank lines before/after ?php ?. Removed
these and everything is working great now!!
Can
Anyone have any ideals why when the if statement is being by-passed?
The 'if' statement in JavaScript is reliable.
If your if( data == 'no' ) is taking the else path, the most likely
reason is that the data variable is indeed not equal to no.
Even though the console.log showed a value of no, are you sure there isn't
a newline at the end? What does
I'm a fan of this approach:
console.log('[' + data.length + ']')
andy
-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Michael Geary
Sent: Friday, January 02, 2009 4:23 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: JQUERY
Good point. Of course, data.length is a number, so it won't have a newline
to worry about anyway. But if you're just displaying the data *string*, the
brackets (or choose your favorite delimiter) are an excellent idea:
console.log( '[' + data + ']' );
That would make it obvious if data has a
This is probably a good reason to make it a habit to return a JSON
object, so that the data is not simply a string of characters with the
associated ambiguities. I realize this leaves me open to
counterarguments of 'it's not a efficient' but really that's a minor
worry (to me that is).
On Jan
That is an excellent idea; I agree completely. There's nothing inefficient
about it either.
It also leaves the door open to return additional data without breaking your
existing code.
{ valid:true }
{ valid:false }
Now if you want to add other properties to that data, you don't have to
change
7 matches
Mail list logo