Ecshop ie selects the red packet Ajax callback function and does not execute it. FF is normal. The problem has been solved. Please explain the reason!

Source: Internet
Author: User

During the secondary development of ecshop, I found that the Ajax callback function is not executed when I select a red envelope for IE shopping cart settlement, but FF is normal. The final modification is OK, but the specific reason is unknown. Please use uppercase letters for discussion.

The original ecshop does not have this problem, but this problem occurs only when I use jquery. For details about how jquery is referenced, refer to another blog article of the author: ecshop jquery conflict solution.

The details are as follows:

JS Code when selecting the original ecshop red packet: shopping_flow.js

/*** Change red packet */function changebonus (VAL) {/* If (selectedbonus = Val) // modify by zjm {return;} else {selectedbonus = val ;} */Ajax. call ('flow. PHP? Step = change_bonus ', 'bonus =' + val, changebonusresponse, 'get', 'json');}/*** callback function for changing the red envelope */function changebonusresponse (OBJ) {If (obj. error) {alert (obj. error); try {document. getelementbyid ('ecs _ bonus '). value = '0';} catch (Ex) {}} else {orderselectedresponse (obj. content );}}

The Ajax call code is in the changebonus function. In IE6, the callback function changebonusresponse is not executed. when the Alert Code is added before and after the call function, the Alert Code is displayed normally, indicating that the js code is executed normally. If there is an error, the JS Code will be terminated, or at least the next alertr code will not be executed. FF is normal.

If the Alert Code is added to the first line of the changebonusresponse function, ie does not execute the code.

The above two problems indicate that the callback function has not been executed in IE, but JS has not reported an error. I have never understood the reason. But there is still a way to solve the problem, that is, you don't need to use ecshop's own Ajax call, instead use jquery's call:

/*** Change red packet */function changebonus (VAL) {/* If (selectedbonus = Val) // modify by zjm {return;} else {selectedbonus = val ;} * // Ajax. call ('flow. PHP? Step = change_bonus ', 'bonus =' + val, changebonusresponse, 'get', 'json'); $. Get ('flow. php? Step = change_bonus & bonus = '+ val, changebonusresponse);}/*** callback function for changing the red envelope */function changebonusresponse (OBJ) {OBJ = eval ('+ OBJ +'); If (obj. error) {alert (obj. error); try {document. getelementbyid ('ecs _ bonus '). value = '0';} catch (Ex) {}} else {orderselectedresponse (obj. content );}}

The above code is very simple. I believe that anyone familiar with jquery will be very familiar with it. However, I have never understood why the original code IE6 has a problem. Please kindly advise me.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.