Okay, I admit it. It was entirely my fault.
A couple of weeks ago I was writing some code for a client of mine, making the app all Web 2.0-y-ish. I'm using AjaxCFC for jQuery and it keeps telling me that a critical error has occurred and that I can click OK to see what's the matter.
So, I click. And all I see is my data in the resulting popup; Not an error, but the actual data that I was expecting back! Um... is this a bug in AjaxCFC? I'm not sure, so I check and re-check my code. I try several things, but I'm just grasping at straws. So, I ask Rob Gonda what the heck I'm doin' wrong.
Well, he helped me as best he could, but in the end it wasn't AjaxCFC at all! Finally I figure out what the problem is: in the success parameter of the AjaxCFC call, I was immediately trying to dump the resulting data using $.dump(data);. Well, there's nothing wrong with that... unless you've forgotten to include the plug-in that makes the $.dump() function work.
oops... color me embarrassed.
So, today it happens again! I check and re-check my code again, and whereas last time I was using a $.dump(); this time I was just using a plain ol' alert();
Well, long story short (what's that you say? too late?) it turns out that the line of code I'd put in was:
$.AjaxCFC({
url: "myCFC",
method: "myMethod",
data: {},
serialization: "json",
success: function(data){
alert(done); /* hmm... what's wrong with this line?*/
}
});
instead of:
$.AjaxCFC({
url: "myCFC",
method: "myMethod",
data: {},
serialization: "json",
success: function(data){
alert("done"); /* That's right it was supposed to be a string... d'oh!*/
}
});
So, the moral of the story is: If AjaxCFC tells you there's an error, but it only shows you the data you expected... you've probably made some other mistake elsewhere in your JavaScript. Most likely in the success parameter of the ajax call. So triple-check your code. It could just be a boneheaded mistake. :o)
Thanks for all your patience Rob. And thanks for a wonderful plug-in!
Cheers