I am using jQuery's ajax functions to make my ajax request.
My question is if I caught an error how do I then redirect to a error page, say I've got the error, logged it, and now want to redirect to a error page, is it possible within the ajax request or will it just redirect the request not the page performing the request?
Do I have to state an error has occurred within the request, by changing the headers HTTP status to say 500 then within the ajax error function direct to a error page?
However within my ajax request if I have already echoed out data and then want to change the header information, will cleaning the buffer allow me to then change the headers?
Is this how I would clean the buffer?
if(ob_get_length()) ob_clean();
How I normally redirect, include a error page :
header('HTTP/1.1 500 Internal Server Error', TRUE, 500);
readfile("500.html");
Within my ajax request would I just change the header like above and then deal with the rest with jQuery?