You don't need to hard code it because the application.cfc/cfm will dynamically
set this up for you.
Script based code (translate to tag based):
onapplicationstart(){
application.datasource = 'mydatasource';
}
or if you have a bunch....
onapplicationstart(){
application.datasource = arraynew(1);
application.datasource[1] = 'localdatabase';
application.datasource[2] = 'remotedatabase';
}
<cffunction name="ajaxrequest">
<cfargument name="datasourceindicator" required="true">
<cfargument name="id" required="true">
<cfquery name="myquery"
datasource="#application.datasource[datasourceindicator]#">
</cfquery>
</cffunction>
..in your javascript....
var a = new ajaxproxyobject();
var returnvar = a.ajaxrequest(1,myid);
This way no one has a clue what you are doing on the client side but the
component still understands what is happening.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:326167
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4