I have a problem where sometimes the data payload in the AJAX code below is not sent to the server.
// loans_url, sample_id, sample defined above this block
$.ajax({
type: "POST",
url: loans_url,
data: {'loan[sample_id]':sample_id},
beforeSend: function() { sample.remove(); },
success: function(data) { $('#basket table tr:last').after(data); },
error: function() { $('#results').prepend("Apologetic error message..."); }
});
A "good" post sends data looking like this: loan[sample_id]: 1234
. A "bad" post hits the correct URL but does not send any data at all.
I cannot reproduce this in development yet it happens about once a day in production. In Firebug I tried sabotaging the markup in the page from which sample_id is obtained, but that simply caused loan[sample_id]: undefined
to be sent, which is not the problem I am facing.
Is there any way the data payload could be not sent at all? Can you suggest how I might debug this further? (This is all with jQuery 1.3.2.)