Your URL indicates you are returning json (returnType=json). But, you
do not specify a dataType for the $.ajax() call. So, your "response"
variable is plain text, I think.
Two things to try:
1) put dataType: "json", before the success line.
2) first line of the success function, do something like
"console.log(response);" and see what you get. If it is plain text, you
will see the text. if it is JSON, you should get an object or array
shown (firebug will color code these for you. um.. you ARE using
Firebug aren't you? lol )
HTH
Shawn
Rick Faircloth wrote:
Is there something missing that would keep it from functioning?
This ajax function only serves to cause a ColdFusion function to create
HTML that is then loaded as specified in the code.
However, the success part of the function is not executed.
No errors or anything…it’s as if the ajax function just doesn’t work at all.
If I put “alert(‘Inside function’); “ just after the first line of the
function and
before the $.ajax line below, the alert fires properly. If I add an alert
in the response section in the first line of the “if” section, the alert
doesn’t fire.
Again, no errors from my server-side code or for the jQuery.
So, the question is whether or not the $.ajax function will work as coded,
or are other parameters needed? (I tried ‘post’ for type, as well…)
Here’s the $.ajax function:
<script type=”text/javascript”>
function buildLoginDialog() {
$.ajax = ({ cache: false,
type: 'get',
url:
'components/login.cfc?method=mBuildLoginDialog&returnType=json',
success: function(response) {
if ( (response.STATUS = 'Login
Dialog Build Successful') )
{ var loginDialogHTML =
'components/loginDialogHTML.cfm?' + new Date().getTime();
$('.loginDialog').load(loginDialogHTML);
login(); }
else { alert('Login Dialog Build
Failed'); }
}
});
}
</script>
Thoughts or suggestions, anyone?
Thanks,
Rick
/-------------------------------------------------------------------------------------------------------------------/
/"Those who hammer their guns into plows will plow for those who do
not." - Thomas Jefferson/