jQuery Ajax调用有一天停止工作

时间:2014-06-25 15:33:44

标签: php jquery ajax wordpress http-status-code-404

好。我在另一篇StackOverflow帖子上找到了答案。

jQuery Ajax returning 404 Error, but correct Response

虽然该特定帖子假设我的Wordpress安装可能已更新,但建议的解决方案可以完美地解决我的问题。加载wp-load.php导致ajax调用完美运行。

遗憾的是,我在创建这篇文章后才发现答案! 我发誓做了我的研究:(

以下是原始问题:

---------------------------------------------

几个月前,我创建了一个简单的jQuery ajax调用,它调用一个php文件来接收一小部分HTML作为响应。

电话看起来像这样。

function ajaxTable() {
            var request = $.ajax({
                url: "/wp-content/themes/itul.theme.wp.abc/includes/download-ajax.php",
                type: "POST",            
                dataType: "html",
                data: { model: $('#download-model-select').find(':selected').data('id')}
            });

            request.done(function(msg) {
                $("#download-table tbody").html(msg);          
            });

            request.fail(function(jqXHR, textStatus) {
                alert( "Request failed: " + textStatus );
            });
        }

该代码一直运行良好,直到大约两天前有人注意到该页面已停止工作。

绝对没有交互与它背后的代码,但我在网站上调用的所有jQuery ajax调用都已停止工作。我上面发布的代码是网站上托管的各种ajax调用的最简单实现。

出于某种原因,尽管手动进入URL会返回结果,但调用仍会标记404错误!我曾尝试将呼叫类型从POST更改为GET,但也没有成功。尝试进入以下URL,您将看到.php文件已到位并提供必要的响应。

http://digital-watchdog.com/wp-content/themes/itul.theme.wp.abc/includes/download-ajax.php?model=856

经过多次挫折之后,我进去检查了响应标题,并且中提琴!似乎我的ajax调用一直在接收正确的信息!但为什么它会继续标记404错误?

我将粘贴下面的标题信息。如果您之前见过这样的事情,请告诉我。

谢谢。

Remote Address:50.62.69.1:80
Request URL:http://digital-watchdog.com/wp-content/themes/itul.theme.wp.abc/includes/download-ajax.php?model=569
Request Method:GET
Status Code:404 Not Found
Request Headersview parsed
GET /wp-content/themes/itul.theme.wp.abc/includes/download-ajax.php?model=569 HTTP/1.1
Host: digital-watchdog.com
Connection: keep-alive
Accept: text/html, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Referer: http://digital-watchdog.com/support/download/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ko;q=0.6,es;q=0.4
Cookie: hsfirstvisit=http%3A%2F%2Fdigital-watchdog.com%2Fsupport%2Ftraining%2Fdw-spectrum-certification-san-francisco%2F|http%3A%2F%2Fdigital-watchdog.com%2Fwp-admin%2Fpost.php%3Fpost%3D1497%26action%3Dedit%26message%3D6|1392226058154; language=en; currency=USD; wp-settings-1=hidetb%3D1%26editor%3Dtinymce%26urlbutton%3Dnone%26imgsize%3Dfull%26align%3Dleft%26wordblock_category_tab%3Dpop%26libraryContent%3Dbrowse%26wplink%3D1%26ed_size%3D1042; wp-settings-time-1=1403654552; __utma=143756192.1546910067.1390588707.1403647017.1403708197.349; __utmb=143756192.6.10.1403708197; __utmc=143756192; __utmz=143756192.1401822249.292.9.utmcsr=hs_email|utmccn=(not%20set)|utmcmd=email; __hstc=74344461.64d6fa8253755804582ef98e557366d7.1392226058157.1403647017540.1403708204775.313; __hssrc=1; __hssc=74344461.6.1403708204775; hubspotutk=64d6fa8253755804582ef98e557366d7
Query String Parametersview parsed
model=569
Response Headersview parsed
HTTP/1.1 404 Not Found
Date: Wed, 25 Jun 2014 15:24:08 GMT
Server: Apache
X-Pingback: http://digital-watchdog.com/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

0 个答案:

没有答案