Victor...
What version of CF are you using? Can you share your code? That would be
much simpler. I went ahead and threw together a quick example of how cfwddx
and an ajax call should work. Both files should be placed in the same
directory. Note that when test.html first loads, you'll get an alert with
plain text...that's the string that's actually being returned by the cfm
page. Before it can be used as JavaScript, it must first be evaluated.
TEST.CFM
---------
<cfscript>
myStruct = {};
myStruct['one'] = 1;
myStruct['two'] = 2;
myStruct['three'] = 3;
</cfscript>
<cfwddx action="cfml2js" input="#myStruct#" topLevelVariable="d">
TEST.HTML
---------
<html>
<head>
<title> new document </title>
<script src="jquery/jquery-1.3.1.min.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
$.get('test.cfm', function(data){
alert(data);
eval(data);
console.log(d);
alert(d['two']);
});
});
//-->
</script>
</head>
<body>
<!--- left empty --->
</body>
</html>
Hope this helps you out.
-----Original Message-----
From: Victor Moore [mailto:[email protected]]
Sent: Saturday, January 23, 2010 6:55 PM
To: cf-talk
Subject: Re: jQuery loaded page and <cfwddx
Yes, it's a get.
It seems that after I restarted the browser the jQuery event click on the
button works.
But I still can't access the toplevelvariable that was setup by the cfddx
call when the page was loaded.
Thanks
Victor
On Sat, Jan 23, 2010 at 6:27 PM, lists <[email protected]> wrote:
>
> I assume you're using a get call. What happens when you console.log
> the argument passed to your success callback function?
>
> If you're not using getjson Then most likely you need to evaluate the
> argument before it's ready to be used.
>
> On Jan 23, 2010, at 2:06 PM, Victorng Moore <[email protected]>
> wrote:
>
>>
>> Hi,
>>
>> I am loading a cfm page with jQuery.
>> On that page I use <cfwddx.. action="cfml2js"...
>> If I try to access the top variable and it tells me that it's
>> undefined, bu I can clearly see it in firebug if i expend the jQuery
>> call that it's there.
>>
>>
>> any idea what I'm missing?
>>
>> Thanks
>> Victor
>>
>> PS BTW i have also tried to trigger a click event on a button on the
>> page and it's not being triggered.
>>
>> I have tried using the live function too with no success
>>
>> $("input:button[name='test']").live ("click", function(){
>> alert (this.id);
>> });
>>
>> No error but no alert...
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330082
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4