i want to create a function for sending error messages from $.ajax posts via email to myself, here's my code:
$.ajax({
type: "POST",
url: my_url,
data: data,
beforeSend: function(request, settings) {
request.settings = settings;
},
success: function(data) {
},
error: function (request, status, error)
{
send_error(status, error, request);
}
});
i mapped the request.settings into the ajax call in order to receive extra infos for my send_error function. i'm getting infos like url, type, data, responseText (= server's error message). i would like also getting the referrer URL so i can see where it was triggered. seems it's only inside the responseText, a link inside the server's error message. is there a better alternative for getting the referrer URL? thanks