I have a message forum that I wrote a few years ago and have been building on ever since. I've been wanting to add some AJAX functionality to it using the new CFAJAX feature of CF8.
I went to learncf.com and downloded their tutorial. It runs perfectly, and I used it as a model for what I've written.
I have two instances here with the same problem. First, I try to pass the value #userid# via my JS call to the AJAX instance, because the system does a check to see if there are any private messages waiting.
In the second case, I'm passing #threadid# because I'm using it to quickly subscribe/unsubscribe while viewing a thread.
In both cases, the CFC never receives the value. It's always zero. I got the first one to work by referencing #cookie.userid# in the CFC, although I know that's not good programming practice. At least I know the CFC and the AJAX call works.
I've made sure I spelled things right... there are no case-sensitivity issues in the variable names, etc. I've done View Source on the rendered page to ensure the value is there. I've put an Alert() function in the AJAX call just before it makes the call, to ensure the value is still there. It is. I've put CFLOGs in the CFC to see what arguments.userid or arguments.thread id is, and it's zero. I've even logged a CFDUMP and it's zero in that too.
Next, I used Firebug (addon to Firefox for those who don't know what it is -- VERY slick) to watch the actual call take place. The value gets passed, as I see this:
And I get this back:
So it's getting the proper value, but for some reason, the CFC is blind to it.
I thought maybe I had a unique bug on my server setup (Win2k3, CF8 with Hotfix 2), but then I thought about the learncf.com tutorial. One of the two pieces of that tutorial passes a parameter to its proxy.cfc and it works just fine. So instead, something else must be weird.