程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jQuery ajax readystate 0响应文本状态0 statustext错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决jQuery ajax readystate 0响应文本状态0 statustext错误?

开发过程中遇到jQuery ajax readystate 0响应文本状态0 statustext错误的问题如何解决?下面主要结合日常开发的经验,给出你关于jQuery ajax readystate 0响应文本状态0 statustext错误的解决方法建议,希望对你解决jQuery ajax readystate 0响应文本状态0 statustext错误有所启发或帮助;

我的情况是,我有一个链接按钮,但我没有使用e.PreventDefault()

<asp:linkbutton ID="lnkSearch" runat="server" CSSClass="DockCmdsearch" Commandname="Search" OnClIEntClick="return VerifySearch(this, event);" />

function VerifySearch(sender, E) {        
    e.preventDefault();
    $.AJAX({
                type: 'POST',
    .............
    }
    return false;
}

解决方法

我收到以下错误:jquery ajax readystate 0 responsetext status 0 statustext error给它时:
url(http://www.tutorialspoint.com/prototype/prototype_ajax_response.htm),但是当我url(localhost:""/embparse_pagE)在本地主机上给它时,它工作正常。

我尝试使用在Google搜索中找到的标头,也使用过标头beforeSend:"",但仍然无法正常工作。

我认为主要问题是:XMLhttprequest cAnnot load http://www.tutorialspoint.com/prototype/prototype_ajax_response.htm. Origin "local server" is not allowed by Access-Control-Allow-Origin.但是我不明白。

任何人都可以向我解释这个问题,因为我对此很陌生。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ng="http://angularjs.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta Access-Control-Allow-Origin="*" />
    <title>Page Parsing</title>
    <script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
    <script>
    getit=function(){
        jQuery.support.cors = true;
        $.ajax({
            type:"GET",url:"http://www.tutorialspoint.com/prototype/prototype_ajax_response.htm",dataType:"html",crossDomain:true,beforeSend: function(xhr) {
                xhr.overrideMimeType('text/plain;charset=UTF-8');
            },success:function(XMLhttprequest,jqXHR,data) {
                //alert(data.titlE);
                var starttitl=data.lasTindexOf('<title>');
                var endtitl=data.lasTindexOf('</title>');
                var title1=data.subString(starttitl+7,endtitl);
                alert(title1);
            },error:function(errorStatus,xhr) {
                alert("Error"+JSON.Stringify(errorStatus));
            }
        });
    }   
    </script>
</head>
<body>
    <div id="siteloader">
        <input type="button" onclick="getit()" />
    </div>
</body>
</html>
@H_772_41@@H_772_41@
@H_772_41@

大佬总结

以上是大佬教程为你收集整理的jQuery ajax readystate 0响应文本状态0 statustext错误全部内容,希望文章能够帮你解决jQuery ajax readystate 0响应文本状态0 statustext错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。