简体   繁体   English

选择列表值的ColdFusion URL变量

[英]ColdFusion URL variable of a selectlist value

I have a select list that I am populating via a call to a CFC 我有一个选择列表,我通过调用CFC填充

<select class="required" name="customer_checkout" id="customer_checkout" tabindex="0" onchange="PopulateGrandTotal();">
            <option>Please make a selection</option></select>

Once a user makes a selection I have them being directed to a payment gateway for a checkout process and the I am required to provide them with a call back URL for when the transaction is complete. 一旦用户做出选择,我就将它们定向到支付网关以进行结账过程,并且我需要在交易完成时向他们提供回叫URL。 I would like like to provided a URL variable in that callback URL of the value of the selection made from my selectlist, but I am unsure of how to do that. 我想在该回调URL中提供一个URL变量,其中包含从我的选择列表中选择的值,但我不确定如何做到这一点。

I was thinking I could get the value on the fly via javascript by something like this: 我以为我可以通过javascript通过以下方式获得价值:

var variable = encodeURIComponent($('#customer_checkout').val());

But I don't know how to get that into a URL variable. 但我不知道如何将其变为URL变量。

My callback url looks something like this currently: 我的回调网址目前看起来像这样:

"https://www.myurl.com/pos/check_out.cfm?msg=1"

I would like to add another URL variable after the current msg variable. 我想在当前的msg变量之后添加另一个URL变量。

If you are processing the redirect via javascript and you have the URL encoded value and you have the URL itself, you can do a simple concatenation via javascript like var newURL = "https://www.myurl.com/pos/check_out.cfm?msg=1&myvar=" + variable; 如果您正在通过javascript处理重定向并且您具有URL编码值并且您拥有URL本身,则可以通过javascript进行简单连接,例如var newURL = "https://www.myurl.com/pos/check_out.cfm?msg=1&myvar=" + variable; If this doesn't answer the question, could you update your question with full sample code (ie gist, plunker, jsfiddle, etc)? 如果这不能回答这个问题,你能否用完整的示例代码更新你的问题(即gist,plunker,jsfiddle等)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM