I think jQuery's serialize() only works on forms.

Since you can't pass a JS object to the server, you'll probably have to
serialize it yourself before you pass it in the ajax call.

Also since you are doing $("dat").serialize(), jQuery is looking for a tag
named "dat" rather than the variable dat.  You would want $( dat
).serialize(), but I'm not sure that would work anyway, since serialize() is
geared toward form serialization.

-- Josh


-----Original Message-----
From: Tony Bentley [mailto:cascadefreehee...@gmail.com] 
Sent: Thursday, April 29, 2010 9:53 AM
To: cf-talk
Subject: Re: jquery $.ajax - need help with json syntax


If I use serialize I get nothing passed as a post argument. I am requiring
all args and I get the error as normal, "...required but not passed in".

        var dat = {
                        'OBJ': obj,
                        'VAL': val,
                        'ATTR': attr,
                        'TIMESTAMP': time
                };
        return $.ajax({
                url: "mycfc.cfc?method=dbupdate",
                dataType: 'json',
                data: $("dat").serialize(),
                type: 'post',
                success: callBack
        });

Serialize() seems to return nothing. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:333249
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to