AJAX发布-{"readyState":0,"responseText" ::“","status":0,"statusText":"error"} [英] AJAX post - {"readyState":0,"responseText":"","status":0,"statusText":"error"}

查看:986
本文介绍了AJAX发布-{"readyState":0,"responseText" ::“","status":0,"statusText":"error"}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个JavaScript,但无法正常工作:我收到以下错误:{"readyState":0,"responseText":"","status":0,"statusText":"error"} 该脚本包含在我网站的网页中,该网页位于该网站的子目录中.

I have this javascript but it is not working : I receive the following error : {"readyState":0,"responseText":"","status":0,"statusText":"error"} This script is included in a webpage of my site which is in a subdirectory of the site.

从我的调试中,我不知道错误的来源...(因为我对网站的索引网页所做的操作完全相同,而另一个javascript看起来几乎相同)

From my debugging, I do not understand where the error can come from... (since I do quite exactly the same for the index webpage of my site with another javascript which looks almost the same)

$(document).ready(function() {
    //if submit button is clicked
    $('#filterbtn').click(function () {        

        //Get the data from all the fields
        var a = JSON.stringify( $("#multiselect").val() );
        var b;
        if ($('#b').prop('checked')) {
            b = 0;
        } else {
            b = 1;
        }
        var c = JSON.stringify($("#Sliderstart").slider("value"));
        var d = JSON.stringify($("#Sliderend").slider("value"));

        //organize the data properly
        var data = 'b=' + b + '&c=' + c + '&d=' + d + '&a=' + a;

        //start the ajax
        $.ajax({
            url: "./filter.php", 
            type: "POST",         
            data: data, 
            crossDomain: true,  
            cache: false,
            success: function (html) {                  
                document.getElementById("message").innerHTML=html;                              
            },
            error: function (e) {
                alert(JSON.stringify(e));
            }        
        });
        return false;
    });     
 });  

谢谢你们!

欢呼

推荐答案

这是当您请求不存在的URL时遇到的错误类型.

This is the kind of error you get when you request an url that doesn't exist.

尝试更改此内容:

url: "./filter.php"

到这样的笨拙路径:

url: "/PATH_TO_FILTER/filter.php"

这篇关于AJAX发布-{"readyState":0,"responseText" ::“","status":0,"statusText":"error"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆