First look at the Code:
Page Ajax post submission code
$. Post ('goods _ QuickAdd. php? Action = updat', {goods_code: $ ('# goods_code1 '). val (), goods_name: $ ('# goods_name1 '). val (), CAT: $ ('# cat1 '). val (), PID: PID, weight: $ ('# weight '). val (), Rand: math. random ()}, function (data) {If (Data = 1) Alert ('Update failed'); else {$ ('# title _' + PID ). text ($ ('# goods_code1 '). val () + ''+ $ ('# goods_name1 '). val (); $ ('# Cat _' + PID ). text ($ ('# cat1 '). find ("option: Selected "). text () ;}$. fancybox. close ();})
Post submission page background processing code: Mainly database operations, return 0 (successful) or 1 (failed) according to the database operation results)
if($db->query($sql))echo 0;elseecho 1;exit;
The above code runs normally in Firefox, but the front-end page does not change when it is executed in IE6 or IE8. After checking, it is found that the background page is running normally (the database operation has been executed ). That is to say, the callback function in IE is not executed.
I used Ajax for a year or two. Most of them use the get method, which has never happened before. I tried to change it to the get method, and then gave up. This is because we have encountered similar problems in the secondary development of ecshop, and we have not found the real cause.
After multiple debugging, the following code is added to the background page, and the callback function in IE can be executed (PHP ).
header('Content-Type:text/html; charset=utf-8');header('Expires: Thu, 01 Jan 1970 00:00:01 GMT');header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');header('Cache-Control: no-cache, must-revalidate, max-age=0');header('Pragma: no-cache');
It is also possible that only one of the above statements can be used. If you are interested, you can try it.
I hope the above methods will be useful in your actual work!