I've got the follow situation:
On my local server I made this call
File: history.js
$(document).ready(function() {
$('button[data-pid]').click(function() {
$.ajax({
cache: false,
data: JSON.stringify({ pch_id: $(this).data('pid') }),
dataType: 'json',
type: 'POST',
url: REPAIR_BROKEN_BANNER_URL
}).done(function(data) {
$('#fix-broken-banner-text').text(data.message);
if (!data.error) {
$('#fix-broken-banner-modal').on('hidden.bs.modal', function() {
window.location.href = window.location.href;
});
}
$('#fix-broken-banner-modal').modal('show');
}).fail(function() {
$('#fix-broken-banner-text').text(REPAIR_BROKEN_ERR_GENERIC);
$('#fix-broken-banner-modal').modal('show');
});
});
});
Page inclusion
var REPAIR_BROKEN_BANNER_URL = '/admin/banners/repair-broken-banner/';
var REPAIR_BROKEN_ERR_GENERIC = 'Unable to perform the action';
The server responds always with a JSON, still it happened an error.
The issue is on the production server. (Production server is a virtual server with Debian). When the ajax call the action, it gets always a blank response, with the follow headers:
Request Headers CAUTION: Provisional headers are shown.
Accept:application/json, text/javascript, /; q=0.01
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Data
pch_id:697f1eaa2fc691a9a7d22d315f7ed8c966febe8ec2c57c1c7a867897f6431dfb8b596ef9dd8f2394c875c638496f7ec9
I thought it could be a php error, but If I write a message and die at the first script call, the page remains blank. In the apache access logs there's no trace of the call.
I've tried this call in firefox and it doesn't appear into the XHR tab, as though the call it's not performed.
EDIT: Javascript part is complete