The status of the server response (200, 404, ...) in a synchronous page load?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
How to use javascript to check the status of server response (200, 404, ...) in case of primary synchronous page load? Ie XMLHttpRequest in this case does not exist.
by | 4 views

4 Answers

0 like 0 dislike
On the server side you know the status. Pass it to JavaScript.
On PHP:
echo 'var status='.$status.';';
by
0 like 0 dislike
If you have received a response from the server 200, 404,... in primary synchronous load, the javascript code could not get to the client browser and cannot be executed.
If it is necessary, pay attention to the scripts embedded in the browser, but where is the guarantee that this plugin will set all your visitors?
by
0 like 0 dislike
It is possible using the XMLHttpRequest to request the same page again.
In General, what a strange task, I want to answer that you should not be required :-)
by
0 like 0 dislike
by
110,608 questions
257,186 answers
0 comments
25,907 users