testing for 404
Could I do this using Ajax? I am not really much of a client side developer and I am in a position where I have to learn some bits.
I am developing a help system where when a button is clicked a light box opens up an external help file
(it has to be external due to the server architecture and layout, please I have gone into this enough...)
Anyway the gist is this, if I perform a request and the page is not found I want a 'page not ready' page to be displayed instead, and the best way i can find round this is if the page returns a 404. So if I get this 404 I can call the default page instead.
I really am not looking for code examples (yet!) as I want to be able to try this out myself. But I need to know is it is possible that on a page button click can I discover if the page requested actually exists or not?
yes, you can do that with AJAX. there are 2 principal ways to do it:
- only check for the file: make a HEAD request (like GET, only it asks for headers). check if the status property is 404.
- make a regular file request. check if the status property is 404.
|All times are GMT +1. The time now is 12:00 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.