You could simply put an incorrect URL into the URL attribute of the AJAX call., something like this:
<?php
header("HTTP/1.0 404 Not Found");
exit();
//the rest of your code
You can simply comment it out later when you're done testing your error function.