Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 501在CFC上使用AJAX时出错_Jquery_Apache_Tomcat_Coldfusion_Coldfusion 10 - Fatal编程技术网

Jquery 501在CFC上使用AJAX时出错

Jquery 501在CFC上使用AJAX时出错,jquery,apache,tomcat,coldfusion,coldfusion-10,Jquery,Apache,Tomcat,Coldfusion,Coldfusion 10,我有以下表格: <!DOCTYPE html> <head> </head> <body> <div> <label> <h1>Input 1</h1> </label> <form> <input type="text" name="input_1" class="input"> </form

我有以下表格:

<!DOCTYPE html>
<head>
</head>

<body>
<div>
    <label>
        <h1>Input 1</h1>
    </label>
    <form>
        <input type="text" name="input_1" class="input">
    </form>
</div>
<!---Javascipt Sources --->
<script src="js/vendor/jquery-1.9.1.min.js"></script>
<script src="js/form.js"></script>
</body>
</html>
指的是以下CFC:

<cfcomponent>
<cffunction name="Read" access="remote" output="false">
    <cfreturn true>
</cffunction>
</cfcomponent>

我在Chrome控制台上收到以下错误消息:
“读取http://127.0.0.1:8500/Google%20Drive/testing/cfc/form.cfc 501(此servlet未为此URI实现方法读取)“

以下是该呼叫的预览页面:

Apache Tomcat/7.0.23-错误报告HTTP状态501-此servlet未对此URI实现方法ADDTOSESSION类型状态报告消息此servlet未对此URI实现方法ADDTOSESSION说明服务器不支持满足此请求所需的功能(此servlet没有为此URI实现ADDTOSESSION方法)。

Apache Tomcat/7.0.23

登录RDS后,我可以使用URL
http://127.0.0.1:8500/Google%20Drive/testing/cfc/form.cfc

我是否在代码方面做了错误的事情,或者内置服务器有什么问题?我也在Google Drive文件夹外尝试过,直到webroot,但我得到了相同的错误。应该授予驱动器本身的所有适用权限(用户、管理员、系统)


Windows 7/ColdFusion 10

必须将CFC方法名称作为HTTP参数传递(通过
表单或
url
)。请尝试从设置中删除
方法:“read”
,并将
?method=read
附加到
url
参数中,如下所示:

$.ajax({
        url: "cfc/form.cfc?method=read",
        type: "post",
        data: data,
        success: function(html) {
            if (html == 1) {
                alert('wyslane');
            }
            else {
                alert('wrong');
            }
        }
 });

感谢@imthepitts为我指明了正确的路径。我复制并粘贴了您的代码,但出现了500个错误。我对其进行了一些修改以使其正常工作:

    $.ajax({
            url: "cfc/form.cfc",
            type: "post",
            data: {
                method: "read",
                input1: 'hi'},
            success: function(html) {
                if (html == 1) {
                    alert('wyslane');
                }
                else {
                    alert('wrong');
                }
            }
     });

作为一个附带问题,我在哪里会发现我必须通过表单或URL传递它?我似乎一直在获取关于如何处理AJAX调用的冲突信息,并希望获得一些参考源。感谢您的帮助。

您收到的错误是什么?下面是一个示例。
    $.ajax({
            url: "cfc/form.cfc",
            type: "post",
            data: {
                method: "read",
                input1: 'hi'},
            success: function(html) {
                if (html == 1) {
                    alert('wyslane');
                }
                else {
                    alert('wrong');
                }
            }
     });