Preface:
AjaxCFC is a ColdFusion lib that provides a server-side wrapper for
jQuery. It was created by Rob Gonda and allows CF developers to easily
include Ajax-capabilities into their applications. Currently, its using
jQuery v1.1.3. We're working on moving it to jQuery v1.2.1 and so far,
the Ajax code is working fine in AjaxCFC.
Issue:
One of the features included into AjaxCFC is the ability to call the
blockUI plugin to display an Ajax loading message. AjaxCFC currently
includes the following version of blockUI:
jQuery blockUI plugin Version 0.4 (12/27/2006)
This version works fine with jQuery v1.2.1 but when I upgraded blockUI to:
jQuery blockUI plugin Version 1.33 (09/14/2007)
I get the following error:
jQuery is not defined
[Break on this error] })(jQuery);
Now, the page being called does in fact define jquery.js in the head and
this issue only manifests if I request inclusion of blockUI. The code
for this is:
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.AjaxCFC.js"></script>
<script type="text/javascript">
// additional files
$.AjaxCFC({require:'dDumper'});
// more additional files
//
$.AjaxCFC({require:'json,wddx,dDumper,log4j,DWRSyntax,blockUI'});
// optional global settings
// using these setters also automatically include dependencies
$.AjaxCFCHelper.setDebug(false);
$.AjaxCFCHelper.setBlockUI(true);
$.AjaxCFCHelper.setUseDefaultErrorHandler(true);
$.AjaxCFCHelper.setSerialization('json'); // json, wddx
</script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function() {
// The data to send to the server
var _o = {"bindings": [
{"ircEvent": "PRIVMSG", "method": "newURI", "regex":
"^http://.*"},
{"ircEvent": "PRIVMSG", "method": "deleteURI", "regex":
"^delete.*"},
{"ircEvent": "PRIVMSG", "method": "randomURI", "regex":
"^random.*"}
], "foo" : "bar",
"baz" : "thud"
};
$.AjaxCFC({
url: " echoTest.cfc",
method: "echo",
data: _o,
//data: 'rob',
//data: ['simple string', 'two'],
//unnamedargs: true,
//serialization: "json",
//blockUI: true,
//useDefaultErrorHandler: true,
success: function(data) {
sDumper(data);
}
});
});
</script>
Link that works w/ jQuery v1.2.1 and old blockUI:
http://www.intoajax.com/ajaxcfc/test1/
Link that fails w/ jQuery v1.2.1 and new blockUI:
http://www.intoajax.com/ajaxcfc/test2/
Also, if I *exclude* this line the code will work:
$.AjaxCFCHelper.setBlockUI(true);
Here is the link to the AjaxCFC JS file which handles the inclusion of
blockUI:
http://www.intoajax.com/ajaxcfc/test1/js/jquery.ajaxcfc.js
The code that actually writes the inclusion is:
include: function (script_filename) {
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="' + script_filename + '">');
document.write('</' + 'script' + '>');
}
The above tells me that something in the way that blockUI is being
dynamically inserted into the page is causing blockUI to break. This has
much bigger implications for AjaxCFC as the issue could be more
pervasive than just this one instance of blockUI. It could mean that
other plugins will fail in much the same way.
To be clear, blockUI works perfectly if I just call it as described on
the plugin's main page. You can see that here:
http://www.intoajax.com/ajaxcfc/test1/block.cfm
So this is not an issue with blockUI but apparently an issue with the
way its being included when called by AjaxCFC.
Hopefully someone can shed some light as to why this works fine using
the older version of blockUI but fails with the newer version.
If more information is needed, please let me know.
Rey...