A few months back, I have created a simple jQuery ajax call that pokes a php file to receive a small chunk of HTML back as response.

The call looks like this.

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 );
            });
        }

The code has been working perfectly fine until about two days ago when someone noticed that the page had stopped working.

There had been absolutely no interaction with the code behind it, but all the jQuery ajax calls that I’ve been calling on the website had stopped working at that point. The code I’ve posted above is the simplest implementation of the various ajax calls hosted on the website.

For some reason, the calls kept flagging 404 errors despite the fact that going into the URL manually returns the results just fine! I had tried changing call type from POST to GET with no success either. Try going into the following URL, you’ll see that the .php file is in place and pumping out the necessary response.

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

After much frustration I went in to check the response headers, and viola! It seems that my ajax calls had been receiving the correct information all along! But why does it keep tagging 404 error?

I will paste the header information below. Please let me know if you’ve seen something like this happen before.

Thank you.

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

Read more here: jQuery Ajax call just stopped working one day


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: