In my plugin, I have defined a custom remote function. Here are the contents:
<cfcomponent output="false">
<cffunction name="getPersons" access="remote" output="false">
<cfset var local = {}>
<cfquery name="local.getPersons" >
SELECT FirstName FROM Persons
</cfquery>
<cfreturn local.getPersons>
</cffunction>
</cfcomponent>
This function is defined in file mytest.cfc that is stored under displayObjects/cfc directory.
In my main.cfm file that is stored in displayObjects directory, I need to make a ajax call to the function in mytest.cfc.
I am wondering how can I build proper path.
Calling #$.getCurrentURL()#
returns:
http://localhost:8888/mymura/default/
However, I would somehow need to build and specify the following specify URL path to my ajax query:
http://localhost:8888/mymura/plugins/MyTest1_2/displayObjects/cfc/mytest.cfc
Can someone please tell me what is the recommended way to store plugin-specific .cfc files and how to properly build full path to access them?
Thank you in advance for your help.
Regards,
Peter
EDIT: I am almost there:
<cfoutput>
<a href="#$.currentURL() & pluginConfig.getDirectory()#/displayObjects/cfc/myquery.cfc">My other file</a>
</cfoutput>
This returns:
http://localhost:8888/mymura/default/MyTest1_2/displayObjects/cfc/mytest.cfc
Instead of:
http://localhost:8888/mymura/plugins/MyTest1_2/displayObjects/cfc/mytest.cfc
Method $.currentURL()
returns localhost:8888/mymura/default
. I just need to find a way to traverse up one directory and append "plugins."
Any help is appreciated.