It's my first post/thread here, I haven't been active in forums for some time cause frankly I didn't need it, but this one just got me. I tried everything in my knowledge -and I mean everything, I'm a fanatic trial-and-error tester.
Situation: jQuery, posts some data through Ajax collected primarily from a $('#textarea') to a php file on server. If the data is >X Bytes, I get 404 Not Found and the 404 Html page in Ajax error handler. Otherwise, everything runs smoothly and I get my results.
I must specify that I post to a php file that loads Wordpress's wp-blog-header.php before doing calculations, as the code is intended to be part of a WPplugin.
- I tried to return header("HTTP/1.1 200 OK") as some suggested, considering WP was altering the header for not finding the file as part of the system, and it solved the issue locally for some cases, but not remotly.
- I tried to set the Content-Length in ajax call.
- I switched between the WP type of handling Ajax calls, and having my own .php file, in the folder of my plugin.
- I alternated calling wp-load.php, wp-config.php, and wp-blog-header.php in the beginning of my ajax file, and still nothing (solved some issues locally, but not remotely) Nothing worked. The only thing that works is trimming the content sent to the .php file. 2000-2500B work ok, 3000+B give me 404 not found.
What could this be? post_data_size is 8M on server. Could this be maybe related to SSL as I've seen in some cases? Is this server-side? Please help,
P.S. My Javascript:
var data1 = {
action: 'get-tables',
html: $('#content').val(),
nonce: kwd_settings.nonce
};
$.ajax({
url: kwd_settings.ajax_url,
type: 'POST',
data: data1,
scriptCharset: 'utf-8',
timeout: 10000, /*10 seconds*/
beforeSend: function( xhr ) {
xhr.setRequestHeader("Content-length", $('#content').val().length+500);
showProgress(true);
},
error: function (request, ajaxOptions, thrownError) {
alert(request.statusText);
alert(request.responseText);
showProgress(false);
},
success: function( response ) {
var r= response;
showResponse(r);
}
});