Coldfusion8 <CFDIV> calling ajax from javascript issue

Please look at the attached code which i've simplified for purposes of my issue.

Now you can see that the index.cfm just declares a <CFDIV> for the purposes of loading content into it. The initial content is maincontent.cfm. Within maincontent.cfm i have used the ajaxlink function so that what it links replaces the current content within the cfdiv. Now my issue is this, is there a way to do this without calling the ajaxlink function? The link below it, which calls openEmailPage() is actually generated html from the cf code, and so can not plant an #ajaxlink()# around the link url. Currently the openEmailPage simply forwards to the emailpage.cfm, but i actually want the emailpage.cfm to embed within the cfdiv. How can i ammend the js code to acheive what i'm trying to do.

I don't think i'm doing anything out of the ordinary so i'm sure there's a standard way of doing this, i'm just don't know what that is! Can anyone help me out please? :)

Please ask questions if i haven't explained myself properly.
index.cfm
=======
 
<HTML>
<BODY>
 
<CFDIV bind="url:maincontent.cfm">
 
</BODY>
</HTML>
 
maincontent.cfm
============
 
<SCRIPT>
	function openEmailPage(){
		window.location = "emailpage.cfm";
	}
</SCRIPT>
 
<A href="#ajaxlink("contacts.cfm")#">go to contacts page</A>
 
<!--- this html link is generated from the result of a cfc call --->
<A href="javascript: onclick="openEmailPage();">open email</A>

Open in new window

LVL 1
paddycobbettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott BennettManager TechnologyCommented:
use the ColdFusion.navigate function.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_24.html
index.cfm
=======
 
<HTML>
<BODY>
 
<CFDIV name="mainDiv" bind="url:maincontent.cfm">
 
</BODY>
</HTML>
 
maincontent.cfm
============
 
<A href="#ajaxlink("contacts.cfm")#">go to contacts page</A>
 
<!--- this html link is generated from the result of a cfc call --->
<A href="javascript: onclick="ColdFusion.navigate("emailpage.cfm", "mainDiv");">open email</A>

Open in new window

0
Scott BennettManager TechnologyCommented:
sorry I copy/pasted that poorly the link should be like:
<A href="javascript:ColdFusion.navigate('emailpage.cfm', 'mainDiv');">open email</A>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
paddycobbettAuthor Commented:
Thanks, just what i was looking for. It worked with one slight ammendment, the CFDIV must be given the id attribute a value rather than the name attribute, otherwise the navigate function claims to not find the div. Many thanks! :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.