0
我可以在我的JavaScript文件中使用字符串數組,將它傳遞給ColdFusion頁面,並使用數組中的元素作爲參數在< cfquery> ?JavaScript到Coldfusion,在JavaScript中使用變量來查詢CF
.js文件
$.get("submit.cfm",{arr: obj}).done(function(data) {
alert('The returned data is: ' + data);
});
.CFM
<cfparam name="tempArr" default = "" >
<cfset array = ArrayNew(6)>
<cfloop from="1" to="6" index="i">
<cfset ArrayAppend(array, tempArr[i])>
</cfloop>
該代碼是不完整的,但如何可以通過從JavaScript通過OBJ(字符串數組)的值提供給變量tempArr在我的coldfusion代碼
參見[參考文獻1](http://www.bennadel.com/blog/1887-Using-jQuery-To-Pass-Arrays -To-Remote-ColdFusion-Components.htm),[reference 2](http://www.raymondcamden.com/index.cfm/2010/3/23/Using-jQuery-to-post-an-array-to -a-ColdFusion-Component),[參考3](http://stackoverflow.com/questions/8644816/passing-javascript-array-to-coldfusion-cfc-via-json)和[許多,更多... ](https://www.google.com/#newwindow=1&output=search&q=passing+javascript+array+to+coldfusion) –