200 status for dynamic, ajax driven content

Should a single-page-website, which loads the content dynamically via ajax and adds a state to the browser’s session history stack, return the "200 Status" on every successful state change?

My website’s core code looks like:

$(document).on('click', 'a:not([target="_blank"])', function(e) {     e.preventDefault();     history.pushState(undefined, undefined, $(this).attr('href'));     onUrlChange(); });  function onUrlChange() {     var url = window.location.pathname;     $.ajax({         type: 'POST',         url: 'engine.php',         data: {             ajaxRequest: url,         },         dataType: 'json',     }); }; 

engine.php determines the content based on URL – if the URL is not correct it returns 404 Status, but should it return 200 Status when URL is correct, every time it loads the page’s content?

Currently, it returns 200 Status every time I click a link, but it is the status for my engine.php, so request output is: GET example.com/engine.php -> [HTTP/1.1 200 OK]

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.