gpt4 book ai didi

javascript - ColdFusion 为 ajax 调用 CFC 页面

转载 作者:行者123 更新时间:2023-12-02 14:12:51 25 4
gpt4 key购买 nike

嘿,我正在尝试调用以下 cfm 页面,以便通过 ajax 调用 cfc 页面:

https://dev-thesite.com/personnel/search.cfm页面:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
$.ajax({
type:'GET',
url: 'search_ajax.cfc?method=searchAward',
data: {
Totals:'100',
CodeNum:'165161',
TestYear:'2016',
SelType:'blah',
SelJuris:'juris'
},
success: function(data) {
alert(data);
},
error: function(data) {
console.log('err: ', data);
}
});
});
</script>
<div id="testing"></div>

https://dev-thesite.com/personnel/search_ajax.cfc页面:

<cfcomponent>
<cffunction name="searchAward" access="remote" returntype="string">
<cfargument name="Totals" type="string" required="true">
<cfargument name="CodeNum" type="string" required="true">
<cfargument name="TestYear" type="string" required="true">
<cfargument name="SelType" type="string" required="true">
<cfargument name="SelJuris" type="string" required="true">
<cfscript>
if(arguments.Totals = '5'){
return 'YES!';
} else {
return 'NO!';
}
</cfscript>
</cffunction>
</cfcomponent>

当前运行此程序时,我收到 ajax 调用的错误端。

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

任何帮助都会非常有助于修复 ColdFusion 9 中的此错误!

最佳答案

好吧,看起来所有错误都在于改变这个:

if(arguments.Totals = '5'){

对此:

if(arguments.Totals eq '5'){

仅仅添加eq似乎就已经奇怪地解决了这个问题。

关于javascript - ColdFusion 为 ajax 调用 CFC 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39350272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com