It sounds like you're mixing up server side and client side (spank me
if I'm wrong).

Your server side will be taking some request and spitting out plain
text json. It doesn't know, or need to know, of jquery. An example
plain cfm:

<!--- some.cfm --->
<cfset myData = getMyData() /><!--- some logic --->
<cfsetting enablecfoutputonly="true" showdebugoutput="false" />
<cfcontent reset="true" type="application/json" />
<cfoutput>#serializeJson( myData )#</cfoutput><cfabort />

An ajax request from the client could call the 'some.cfm' page and
when the response comes back the client can interpret that json
response.

So in jQuery:

$(document).ready(function(){
       var url = 'some.cfm', // relative
       mydata = {address1 : '68 N 4000 W', address2 : '' ,city :
'Cedar City', state : 'UT'};

       $.post(url, mydata, function(resp){

             console.dir( resp ); // if you're using firebug or the
Chrome console, check the console tab for output. console.dir is like
a js version of cfdump

       }, 'json'); // this tells jquery that it is expecting a json
string back - your resp variable should now be a parsed object of your
json response

   });

HTH

Dominic






On 7 May 2011 07:53, David Mineer Jr <[email protected]> wrote:
>
> That's a great idea, and I have everything working to do that now.  I get
> the query back, serializeJSON the results and I can see them in an alert
> box.
>
> BUT.  For the life of me I cannot figure out how to access those elements
> with jQuery.
>
> This should probably be in a new thread, and I do see alot of threads where
> people are frustrated with this.  I have been pulling my hair out for hours.
>
> jsonvar = serializeJSON(qry)
> tostring(jsonvar, 'jsvar')
>
> I really just want to do jsvar.field1 or jsvar.field2.  That doesn't work.
> I have tried variations of $.each and everything I can find out there.  No
> luck.
>
> How can I get to those values with jquery?
>
> ---
> David Mineer Jr
> ---------------------
> The critical ingredient is getting off your
> butt and doing something. It's as simple
> as that. A lot of people have ideas, but
> there are few who decide to do
> something about them now. Not
> tomorrow. Not next week. But today.
> The true entrepreneur is a doer.
>
>
> On Fri, May 6, 2011 at 9:54 PM, andy matthews <[email protected]>wrote:
>
>>
>> Simplest thing to do would be to put the cfhttp call into a cfc, then call
>> that from jQuery.
>>
>>
>> andy
>>
>> -----Original Message-----
>> From: David Mineer Jr [mailto:[email protected]]
>> Sent: Friday, May 06, 2011 7:53 PM
>> To: cf-talk
>> Subject: Re: Replace cfhttp with jquery.post()
>>
>>
>> K, hold up.  This has something to do with the ip address of the calling
>> function.  This program can only be called from the local server i.e.
>> localhost.  cfhttp must call from localhost and so it works.  jQuery.post()
>> must call from the client ip address and therefore won't ever work.
>>
>> So I better look more into this and see how I am going to handle this.
>>  This
>> is an internal app and that service only responds to internal requests.
>>
>> ---
>> David Mineer Jr
>> ---------------------
>> The critical ingredient is getting off your
>> butt and doing something. It's as simple
>> as that. A lot of people have ideas, but
>> there are few who decide to do
>> something about them now. Not
>> tomorrow. Not next week. But today.
>> The true entrepreneur is a doer.
>>
>>
>> On Fri, May 6, 2011 at 5:55 PM, David Mineer Jr <[email protected]> wrote:
>>
>> > Nice catch.  I also had address2 instead of addressline2.  I changed
>> those
>> > and still nothing.
>> >
>> > I get the code pasted above for the post info when I click on the link,
>> but
>> > the response info is blank.  That's what has me flustered.  I get nothing
>> > back.  The link turns red and I can alert that there was an error, just
>> > don't know how to return the error that is sent back (assuming it is
>> getting
>> > back to me.
>> >
>> >
>> >
>>
>>
>>
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344336
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to