ajax 的 ColdFusion 调用 CFC 页面
ColdFusion Calling CFC page for ajax
嘿,我正在尝试调用以下 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 调用的 error 端。
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 似乎就很奇怪地修复了它。
嘿,我正在尝试调用以下 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 调用的 error 端。
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 似乎就很奇怪地修复了它。