AJAX POST No longer working
This function worked fine a month ago, before the newest JQuery (1.5) came out. I also upgraded to PHP 5.3--- Those are the only things that have changed since then and now the code is broken.
I doubt the new PHP would effect the javascript POST at all, and I use a local copy of 1.4.2 of JQuery, so I don't see how 1.5 coming out has any effect on me.
The page is located here: [link removed]
The custom form function I use is form_post...which is located here:
$.extend({
form_post : function(url, form, callback) {
var serialized_form_data = $(form).serialize();
$('#sub-navigation-content > *').slideUp('fast');
$('#content-container').hide('fast');
$.ajax({
async: true,
type: 'POST',
url: url,
data:serialized_form_data,
success: function(response) {
var contents = $(response).find('#content-container > *');
$("#content-container").html(contents);
$("#content-container").show('normal');
var sub_nav = $(response).find('#sub-navigation-content > *');
$(response).filter('script[src=""]').each(function(){
sub_nav.push(this);
});
$("#sub-navigation-content").html(sub_nav)
$('#sub-navigation-content > *').hide();
$("#sub-navigation-content > *").css("visibility", "hidden").delay(500).slideDown("开发者_开发问答slow").delay(0).css("visibility", "visible");
if(typeof callback == 'function'){
callback.call(this, response);
}
}
});
}
});
Using chrome's built in network/debugger I see the server returns as resource failed to load, the request gets sent with the right headers and URL, but nothing ever comes back. The more weird thing is that I used an HTTP analyzer and I can capture the HTTP POST, and I see there is no response, but if I mimic the request and send it via the program, everything goes through perfect fine with the exact same headers, POST data, URL, etc.
Why is this breaking?
Edit:
Looking at my PHP errors, I see it MIGHT be related to PHP 5.3:
PHP Warning: Invalid argument supplied for foreach() in /var/www/xxxx/shared/catalog_process.php on line 25
... lol. I am starting to regret switching to PHP 5.3. It doesn't even give me the error in the browser, it just says:
The webpage at [link removed] might be temporarily down or it may have moved permanently to a new web address. Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
However, after fixing that error-- Still no go
I got the following error:
I would check to see if zlib.output_compression is on (http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression) and depending on which web server you are using, I would turn off gzip compression on there and see if that helps.
精彩评论