Create general callback function for ajax requests

-Add simple error reporting in get_loc.php