You might want to consider using ajaxCFC and returning json data. You
won't have to be concerned about white space, and it could come in handy
for a lot of other things:
http://www.robgonda.com/blog/projects/ajaxcfc/
It's very easy to setup/use and uses jquery. I can supply a few code
snippets if you're interested.
- Jack
Web Specialist wrote:
I'll need to test an ajax post to validate if an account already
exists in database. I'm using this code in action page:
<cfsetting showdebugoutput="no">
<cfprocessingdirective suppresswhitespace = "yes"
pageencoding="ISO-8859-1">
<cfheader charset="iso-8859-1" name="Expires"
value="#GetHttpTimeString(Now())#">
<cfcontent reset="true" type="text/plain;charset=ISO-8859-1">
<cfset rndTest = RandRange(90,99)>
<cfif rndTest MOD 2>
<cfoutput>#rndTest#</cfoutput>
<cfelse> <<<<<<<<<< LOOK HERE WITHOUT CFOUTPUT
no
</cfif>
</cfcontent>
</cfprocessingdirective>
Using that script returns(randomly) the "no" with 5 chars(maybe
because <tab> for tags alignment). Including "no" inside <cfoutput
returns 3. Why CF doesn't works properly removing whitespace?
This is the jquery script:
$.ajax({
type: "post",
url: "validateAccount.cfm",
dataType: "html",
data: inputs,
............
Cheers