jquery.ajax() POST receives empty response with IE10 on Nginx/PHP-FPM but works on Apache -
i use simple jquery.ajax()
call fetch html snippet server:
// init add lines button $('body').on('click', '.add-lines', function(e) { $.ajax({ type : 'post', url : $(this).attr('href')+'?ajax=1&addlines=1', data : $('#quickorder').serialize(), success : function(data,x,y) { $('#directorderform').replacewith(data); }, datatype : 'html' }); e.preventdefault(); });
on php side echo out html string. jquery version 1.8.3.
the problem in ie10: while works fine there on server a runs on apache fails on server b runs on nginx + php-fpm: if debug success
handler on server b undefined
data
. in network tab of ie developer tools can see full response , headers. may affect other ie versions, test ie10 far.
here 2 response headers:
server a, apache (works):
http/1.1 200 ok date: thu, 25 apr 2013 13:28:08 gmt server: apache expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache vary: accept-encoding,user-agent content-encoding: gzip content-length: 1268 keep-alive: timeout=2, max=100 connection: keep-alive content-type: text/html; charset=utf-8
server b, nginx + php-fpm (fails):
http/1.1 200 ok server: nginx/1.1.19 date: thu, 25 apr 2013 13:41:43 gmt content-type: text/html; charset=utf8 transfer-encoding: chunked connection: keep-alive expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache content-encoding: gzip
the body part looks same in both cases.
any idea cause issue?
please check content-type header, since apache , nginx sending different values:
content-type: text/html; charset=utf-8
vs.
content-type: text/html; charset=utf8
update nginx config, add line:
charset utf-8;