Running a Coldfusion function server side from a link












0















I have a cfm page which includes a function and runs the function based on some arguments passed to the page as url variables. My requirement is to call the page via a hyperlink/button but not open the page in the browser. The client browser must remain on the page with the hyperlink/button.



To clarify a bit more:



I have a ringout.cfm page with the following code:



<cfinclude template="/functions/easySocket.cfm">
<cfset NL = chr(13) & chr(10) />
<cfset extension = #url.user_extension#>
<cfset outbound_line=#url.partner_line#>
<cfset target_number=#url.target_number#>
<cfset call_type="from-internal">
<cfset call_id="12345">
<cfset caller_id="Blah Blah">
<cfset APICommand="Action: Login#NL#Username: tst#NL#Secret: tst#NL##NL#Action: Originate#NL#Channel: PJSIP/#extension##NL#Exten: #outbound_line##target_number##NL#Context: #call_type##NL#Priority: 1#NL#Callerid: #caller_id##NL#ActionID: #call_id##NL#Async: true#NL##NL#">
<cfoutput>
#easySocket('222.222.xx.xx','5038', APICommand)#
</cfoutput>


I would like to call the above page from within another page (contacts.cfm) without leaving the page. I have the following code in my contacts.cfm:



<a href="#buildUrl("crm.ringout")#&target_number=<cfoutput>#reReplace(#contact_mobile#, "[[:space:]]", "", "ALL")#</cfoutput>&partner_line=302&user_extension=204" runat="server">#contact_mobile#&nbsp</a>


All I would like to do is run the ringout.cfm page server side.










share|improve this question

























  • Seems like a good place to use a very tiny iframe.

    – Dan Bracuk
    Nov 14 '18 at 14:08











  • 1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

    – James A Mohler
    Nov 14 '18 at 14:57






  • 1





    Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

    – Ageax
    Nov 14 '18 at 16:09
















0















I have a cfm page which includes a function and runs the function based on some arguments passed to the page as url variables. My requirement is to call the page via a hyperlink/button but not open the page in the browser. The client browser must remain on the page with the hyperlink/button.



To clarify a bit more:



I have a ringout.cfm page with the following code:



<cfinclude template="/functions/easySocket.cfm">
<cfset NL = chr(13) & chr(10) />
<cfset extension = #url.user_extension#>
<cfset outbound_line=#url.partner_line#>
<cfset target_number=#url.target_number#>
<cfset call_type="from-internal">
<cfset call_id="12345">
<cfset caller_id="Blah Blah">
<cfset APICommand="Action: Login#NL#Username: tst#NL#Secret: tst#NL##NL#Action: Originate#NL#Channel: PJSIP/#extension##NL#Exten: #outbound_line##target_number##NL#Context: #call_type##NL#Priority: 1#NL#Callerid: #caller_id##NL#ActionID: #call_id##NL#Async: true#NL##NL#">
<cfoutput>
#easySocket('222.222.xx.xx','5038', APICommand)#
</cfoutput>


I would like to call the above page from within another page (contacts.cfm) without leaving the page. I have the following code in my contacts.cfm:



<a href="#buildUrl("crm.ringout")#&target_number=<cfoutput>#reReplace(#contact_mobile#, "[[:space:]]", "", "ALL")#</cfoutput>&partner_line=302&user_extension=204" runat="server">#contact_mobile#&nbsp</a>


All I would like to do is run the ringout.cfm page server side.










share|improve this question

























  • Seems like a good place to use a very tiny iframe.

    – Dan Bracuk
    Nov 14 '18 at 14:08











  • 1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

    – James A Mohler
    Nov 14 '18 at 14:57






  • 1





    Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

    – Ageax
    Nov 14 '18 at 16:09














0












0








0








I have a cfm page which includes a function and runs the function based on some arguments passed to the page as url variables. My requirement is to call the page via a hyperlink/button but not open the page in the browser. The client browser must remain on the page with the hyperlink/button.



To clarify a bit more:



I have a ringout.cfm page with the following code:



<cfinclude template="/functions/easySocket.cfm">
<cfset NL = chr(13) & chr(10) />
<cfset extension = #url.user_extension#>
<cfset outbound_line=#url.partner_line#>
<cfset target_number=#url.target_number#>
<cfset call_type="from-internal">
<cfset call_id="12345">
<cfset caller_id="Blah Blah">
<cfset APICommand="Action: Login#NL#Username: tst#NL#Secret: tst#NL##NL#Action: Originate#NL#Channel: PJSIP/#extension##NL#Exten: #outbound_line##target_number##NL#Context: #call_type##NL#Priority: 1#NL#Callerid: #caller_id##NL#ActionID: #call_id##NL#Async: true#NL##NL#">
<cfoutput>
#easySocket('222.222.xx.xx','5038', APICommand)#
</cfoutput>


I would like to call the above page from within another page (contacts.cfm) without leaving the page. I have the following code in my contacts.cfm:



<a href="#buildUrl("crm.ringout")#&target_number=<cfoutput>#reReplace(#contact_mobile#, "[[:space:]]", "", "ALL")#</cfoutput>&partner_line=302&user_extension=204" runat="server">#contact_mobile#&nbsp</a>


All I would like to do is run the ringout.cfm page server side.










share|improve this question
















I have a cfm page which includes a function and runs the function based on some arguments passed to the page as url variables. My requirement is to call the page via a hyperlink/button but not open the page in the browser. The client browser must remain on the page with the hyperlink/button.



To clarify a bit more:



I have a ringout.cfm page with the following code:



<cfinclude template="/functions/easySocket.cfm">
<cfset NL = chr(13) & chr(10) />
<cfset extension = #url.user_extension#>
<cfset outbound_line=#url.partner_line#>
<cfset target_number=#url.target_number#>
<cfset call_type="from-internal">
<cfset call_id="12345">
<cfset caller_id="Blah Blah">
<cfset APICommand="Action: Login#NL#Username: tst#NL#Secret: tst#NL##NL#Action: Originate#NL#Channel: PJSIP/#extension##NL#Exten: #outbound_line##target_number##NL#Context: #call_type##NL#Priority: 1#NL#Callerid: #caller_id##NL#ActionID: #call_id##NL#Async: true#NL##NL#">
<cfoutput>
#easySocket('222.222.xx.xx','5038', APICommand)#
</cfoutput>


I would like to call the above page from within another page (contacts.cfm) without leaving the page. I have the following code in my contacts.cfm:



<a href="#buildUrl("crm.ringout")#&target_number=<cfoutput>#reReplace(#contact_mobile#, "[[:space:]]", "", "ALL")#</cfoutput>&partner_line=302&user_extension=204" runat="server">#contact_mobile#&nbsp</a>


All I would like to do is run the ringout.cfm page server side.







function coldfusion






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 13:54







James Knight

















asked Nov 14 '18 at 13:00









James KnightJames Knight

238




238













  • Seems like a good place to use a very tiny iframe.

    – Dan Bracuk
    Nov 14 '18 at 14:08











  • 1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

    – James A Mohler
    Nov 14 '18 at 14:57






  • 1





    Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

    – Ageax
    Nov 14 '18 at 16:09



















  • Seems like a good place to use a very tiny iframe.

    – Dan Bracuk
    Nov 14 '18 at 14:08











  • 1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

    – James A Mohler
    Nov 14 '18 at 14:57






  • 1





    Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

    – Ageax
    Nov 14 '18 at 16:09

















Seems like a good place to use a very tiny iframe.

– Dan Bracuk
Nov 14 '18 at 14:08





Seems like a good place to use a very tiny iframe.

– Dan Bracuk
Nov 14 '18 at 14:08













1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

– James A Mohler
Nov 14 '18 at 14:57





1. runat="server" makes not sense in the CF world. 2. I see buildURL Are you using FW/1?

– James A Mohler
Nov 14 '18 at 14:57




1




1





Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

– Ageax
Nov 14 '18 at 16:09





Hint: You'll need to use ajax. Running server side code from the client (ie link, button, etc) requires opening a a new http request. To do that without leaving the page requires ajax.

– Ageax
Nov 14 '18 at 16:09












1 Answer
1






active

oldest

votes


















1














You have provided very little information and no code. But as I understand, you can do it. In your xxx.cfm add this code



<cfif structKeyExists(URL,"YOUR_URL_VAR")>
<!--- call your function here, generate the desired output and show as plain text/html or json format. Abort the processing if you know this variable will only exist for specific hyperlink/button call--->
<cfabort>
</cfif>


Then with your link call xxx.cfm and pass the desired url variable along.






share|improve this answer
























  • Thanks for the response - I have updated my question to provide some more information.

    – James Knight
    Nov 14 '18 at 13:54











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300862%2frunning-a-coldfusion-function-server-side-from-a-link%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You have provided very little information and no code. But as I understand, you can do it. In your xxx.cfm add this code



<cfif structKeyExists(URL,"YOUR_URL_VAR")>
<!--- call your function here, generate the desired output and show as plain text/html or json format. Abort the processing if you know this variable will only exist for specific hyperlink/button call--->
<cfabort>
</cfif>


Then with your link call xxx.cfm and pass the desired url variable along.






share|improve this answer
























  • Thanks for the response - I have updated my question to provide some more information.

    – James Knight
    Nov 14 '18 at 13:54
















1














You have provided very little information and no code. But as I understand, you can do it. In your xxx.cfm add this code



<cfif structKeyExists(URL,"YOUR_URL_VAR")>
<!--- call your function here, generate the desired output and show as plain text/html or json format. Abort the processing if you know this variable will only exist for specific hyperlink/button call--->
<cfabort>
</cfif>


Then with your link call xxx.cfm and pass the desired url variable along.






share|improve this answer
























  • Thanks for the response - I have updated my question to provide some more information.

    – James Knight
    Nov 14 '18 at 13:54














1












1








1







You have provided very little information and no code. But as I understand, you can do it. In your xxx.cfm add this code



<cfif structKeyExists(URL,"YOUR_URL_VAR")>
<!--- call your function here, generate the desired output and show as plain text/html or json format. Abort the processing if you know this variable will only exist for specific hyperlink/button call--->
<cfabort>
</cfif>


Then with your link call xxx.cfm and pass the desired url variable along.






share|improve this answer













You have provided very little information and no code. But as I understand, you can do it. In your xxx.cfm add this code



<cfif structKeyExists(URL,"YOUR_URL_VAR")>
<!--- call your function here, generate the desired output and show as plain text/html or json format. Abort the processing if you know this variable will only exist for specific hyperlink/button call--->
<cfabort>
</cfif>


Then with your link call xxx.cfm and pass the desired url variable along.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 13:37









CFML_DeveloperCFML_Developer

1,088416




1,088416













  • Thanks for the response - I have updated my question to provide some more information.

    – James Knight
    Nov 14 '18 at 13:54



















  • Thanks for the response - I have updated my question to provide some more information.

    – James Knight
    Nov 14 '18 at 13:54

















Thanks for the response - I have updated my question to provide some more information.

– James Knight
Nov 14 '18 at 13:54





Thanks for the response - I have updated my question to provide some more information.

– James Knight
Nov 14 '18 at 13:54




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53300862%2frunning-a-coldfusion-function-server-side-from-a-link%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python