Re: jQuery question
you can hit the cfc directly just fine and you did the right thing by setting the returntype in the call instead of in the cfc so you can reuse the cfc without returning just json. Are you sending a form or hard coded info? BTW~ jquery doesn't handle json very much, they have a getJson tag which is useless if you want to gather info back from an ajax call since it asks for the file. if you are sending a form then serialize it and it gathers the fields and sends it which will be a struct the same as a reg form $.ajax({ type: 'post', url: '/cfc/users.cfc?method=addUser&returnFormat=json', data: $("form").serialize(), or with vars var password = $('input[name=password]'); var password2 = $('input[name=password2]'); var data = 'password=' + password.val() + '&password2=' + password2.val() $.ajax({ url: "/admin/cfc/system.cfc?method=checkPassword&returnFormat=plain", type: "post", data: data, ~| 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:325381 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jQuery question
That's not saying you should do what I do or that hitting the cfc directly is bad - just saying how I solve the problem you are having... However, is it absolutely neccessary for the cfc method to take a struct as its single argument? Could you define no arguments at all and use the arguments scope in the same way you are using the struct that you're passing currently? Dominic 2009/8/12 Dominic Watson > My personal preference is not to hit cfc's directly. Instead, I use a > framework (ModelGlue, Fusebox, etc) for *every* request, be it an ajax one > or anything else. My cfc method just knows that it gets given a load of data > and it returns a load of data - it does not need to worry about the output > format of that data. The framework can then get the data it needs and spit > it out in the way asked of it (ie. json, xml, html, etc). > ~| 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:325372 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jQuery question
jQuery was not the problem here. CF knowing what to do with your post variables was. My personal preference is not to hit cfc's directly. Instead, I use a framework (ModelGlue, Fusebox, etc) for *every* request, be it an ajax one or anything else. My cfc method just knows that it gets given a load of data and it returns a load of data - it does not need to worry about the output format of that data. The framework can then get the data it needs and spit it out in the way asked of it (ie. json, xml, html, etc). But that's all besides the point I guess ;) Dominic Man, I figured since jQuery requires you to "code less", it would do > that for me automatically, knowing that it can't pass a complex object > directly. > ~| 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:325371 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jQuery question
On Tue, Aug 11, 2009 at 8:25 PM, Josh Nathanson wrote: > > Like any other form post, you can't pass complex arguments to the server. > What you could do is pass a JSON string and then deserialize it in the CFC. Man, I figured since jQuery requires you to "code less", it would do that for me automatically, knowing that it can't pass a complex object directly. Okay... so a json string in this case would be something like: var command = '{"name":""}'; and then set my argument type to "any" and deserialize if it's json. seems to work. Thanks! -- Rick Root New Brian Vander Ark Album, songs in the music player and cool behind the scenes video at www.myspace.com/brianvanderark ~| 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:325360 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: jQuery question
Hey Rick, Like any other form post, you can't pass complex arguments to the server. What you could do is pass a JSON string and then deserialize it in the CFC. -- Josh -Original Message- From: Rick Root [mailto:rick.r...@webworksllc.com] Sent: Tuesday, August 11, 2009 5:09 PM To: cf-talk Subject: jQuery question I have a CFC hat accepts a struct as its argument. The struct can contain 0 or more items, but the struct itself is required. I want to use jQuery to call this method. But I can't figure out how. what I'm trying to do is this: I'm trying to do this as a jquery post... var command = {name:''}; var url='/cfcs/pools.cfc?method=getPoolList&returnFormat=json'; $.post(url, [command:command], rh_getPoolList, "json"); it is successfully calling the CFC - I have a cfmail in it that emails me a dump of the arguments. And arguments.command is a string that looks like this: [object object] Instead of a struct. Any suggestions? -- Rick Root New Brian Vander Ark Album, songs in the music player and cool behind the scenes video at www.myspace.com/brianvanderark ~| 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:325359 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jquery question
thanks azadi, this looks very much like what i am trying to achieve. mike ~| 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:323221 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: jquery question
Just write the contents of the textarea into the html of the target. -Original Message- From: Mike Little [mailto:m...@nzsolutions.co.nz] Sent: Wednesday, June 03, 2009 7:03 PM To: cf-talk Subject: Re: jquery question thanks guys, my question is though - how to pass formatted content from my textarea to the div upon form submission (or another button submit). ultimately i would like to pass the content to a cfc first to check and amend data as required so this is why i thought jquery would be the way to go. mike ~| 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:323159 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: jquery question
I'll second the use of Pretty Photo. I just put it in place on my site for Flash modal windows and it works awesome. Super easy to install as well. You can see it in action here (click the watch video): http://andymatthews.net/read/2009/05/26/jQuery-and-AIR:-Creating-a-new-AIR-p roject-in-Aptana andy -Original Message- From: Charlie Griefer [mailto:charlie.grie...@gmail.com] Sent: Wednesday, June 03, 2009 5:54 PM To: cf-talk Subject: Re: jquery question check out one of the many jquery lightbox clones. http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clo ne/ http://www.stickmanlabs.com/lightwindow/ On Wed, Jun 3, 2009 at 3:42 PM, Mike Little wrote: > > sorry, could not think of a better subject! > > i have a form which an admin enters a embed script such as a youtube video. > what i would like to achieve is to have a preview button which takes > the contents of the textarea (ultimately filters the content with my > clever param filter) and displays the output in a popup similar to... > > http://yensdesign.com/tutorials/popupjquery/ > > (or alternatively the output displays in a div below the textarea?) > > i am very new to jquery/ajax and really would like to get into it. > unfortunately we have issues with using cf8's ajax features on my > hosts shared server and would like to use native jquery/ajax. > > any help/pointers in the right direction would be really appreciated. > > mike > > ~| 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:323158 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: jquery question
1) make sure your cfc function that processes the textarea content has access="remote" 2) create a button on your page to click to pass the textarea content to your cfc function 3) add onclick="showContent('id-of-your-textarea-here');" to this button (replace 'id-of-your-textarea-here' with actual ID of your textarea!) 4) put this showContent js function into HEAD section of your page, making any necessary changes to it as per comments: var showContent = function(id) { $.get( "path/to/yourcfc.cfc?method=yourCfcFunctionName&content="+$("#"+id).val(), // amend as necessary function(data) { //code here to do whatever you need with returned formatted content //the returned content will be in js variable 'data' }, 'json' // change to data type of returnformat of your cfc fucntion ); }; hth Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ On 04/06/2009 07:03, Mike Little wrote: > thanks guys, > > my question is though - how to pass formatted content from my textarea to the > div upon form submission (or another button submit). ultimately i would like > to pass the content to a cfc first to check and amend data as required so > this is why i thought jquery would be the way to go. > > mike > > ~| 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:323148 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: jquery question
Sorry Mike. I guess I'm not fully understanding where your problem is if you are going to submit form data. Do you want the lightbox to appear automatically after the form is submitted? Why can't you process the submission normally? or are you looking to just submit the script through jquery (i.e load or ajax) to another page and make something happen on your page after it is tweeked? I was not aware that jQuery could communicate directly with a cfc but I am sure someone hear could get that going. I have always communicated with a cfm page which might invoke a cfc. -- Ryan On Wed, Jun 3, 2009 at 7:03 PM, Mike Little wrote: > > thanks guys, > > my question is though - how to pass formatted content from my textarea to > the div upon form submission (or another button submit). ultimately i would > like to pass the content to a cfc first to check and amend data as required > so this is why i thought jquery would be the way to go. > > mike > > ~| 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:323146 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jquery question
thanks guys, my question is though - how to pass formatted content from my textarea to the div upon form submission (or another button submit). ultimately i would like to pass the content to a cfc first to check and amend data as required so this is why i thought jquery would be the way to go. mike ~| 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:323143 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jquery question
I usually choose Thickbox for a lightbox feature. Not the best looking out of the box but very functional and you can always style it. -- Ryan On Wed, Jun 3, 2009 at 5:54 PM, Charlie Griefer wrote: > > check out one of the many jquery lightbox clones. > > > http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/ > http://www.stickmanlabs.com/lightwindow/ > > > On Wed, Jun 3, 2009 at 3:42 PM, Mike Little > wrote: > > > > > sorry, could not think of a better subject! > > > > i have a form which an admin enters a embed script such as a youtube > video. > > what i would like to achieve is to have a preview button which takes the > > contents of the textarea (ultimately filters the content with my clever > > param filter) and displays the output in a popup similar to... > > > > http://yensdesign.com/tutorials/popupjquery/ > > > > (or alternatively the output displays in a div below the textarea?) > > > > i am very new to jquery/ajax and really would like to get into it. > > unfortunately we have issues with using cf8's ajax features on my hosts > > shared server and would like to use native jquery/ajax. > > > > any help/pointers in the right direction would be really appreciated. > > > > mike > > > > > > ~| 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:323138 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: jquery question
check out one of the many jquery lightbox clones. http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/ http://www.stickmanlabs.com/lightwindow/ On Wed, Jun 3, 2009 at 3:42 PM, Mike Little wrote: > > sorry, could not think of a better subject! > > i have a form which an admin enters a embed script such as a youtube video. > what i would like to achieve is to have a preview button which takes the > contents of the textarea (ultimately filters the content with my clever > param filter) and displays the output in a popup similar to... > > http://yensdesign.com/tutorials/popupjquery/ > > (or alternatively the output displays in a div below the textarea?) > > i am very new to jquery/ajax and really would like to get into it. > unfortunately we have issues with using cf8's ajax features on my hosts > shared server and would like to use native jquery/ajax. > > any help/pointers in the right direction would be really appreciated. > > mike > > ~| 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:323137 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: jquery question
Shouldn't be hard at all to have a hidden div prepared. After the text area is changed put the script in the div (getelementbyid) and show the div. I don't think you need ajax for that. You could certainly write it in jQuery syntax but any old javascript should do that. I've never tested it but I think it should work unless there is some issue with the script you are pasting. -- Ryan On Wed, Jun 3, 2009 at 5:42 PM, Mike Little wrote: > > sorry, could not think of a better subject! > > i have a form which an admin enters a embed script such as a youtube video. > what i would like to achieve is to have a preview button which takes the > contents of the textarea (ultimately filters the content with my clever > param filter) and displays the output in a popup similar to... > > http://yensdesign.com/tutorials/popupjquery/ > > (or alternatively the output displays in a div below the textarea?) > > i am very new to jquery/ajax and really would like to get into it. > unfortunately we have issues with using cf8's ajax features on my hosts > shared server and would like to use native jquery/ajax. > > any help/pointers in the right direction would be really appreciated. > > mike > > ~| 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:323136 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4