这很奇怪。第 29 行之前(包括第 29 行)的所有代码都有效。第 29 行之后的所有代码都不起作用。我在控制台上尝试了第 30 行和第 31 行,它们起作用了。我尝试在第 29 行之前添加一行简单的代码,将背景更改为红色,并且成功了。我在第 29 行之后放了同一行,但它没有用。
$('#button-shipping-method').live('click', function() {
$.ajax({
url: 'index.php?route=checkout/shipping_method/validate',
type: 'post',
data: $('#shipping-method input[type=\'radio\']:checked, #shipping-method textarea'),
dataType: 'json',
beforeSend: function() {
$('#button-shipping-method').attr('disabled', true);
$('#button-shipping-method').after('<span class="wait"> <img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
},
complete: function() {
$('#button-shipping-method').attr('disabled', false);
$('.wait').remove();
},
success: function(json) {
$('.warning, .error').remove();
if (json['redirect']) {
location = json['redirect'];
} else if (json['error']) {
if (json['error']['warning']) {
$('#shipping-method .checkout-content').prepend('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.warning').fadeIn('slow');
}
} else {
$.ajax({
url: 'index.php?route=checkout/payment_method',
dataType: 'html',
success: function(html) {
$('#payment-method .checkout-content').html(html); // LINE 29
$('#shipping-method .checkout-content').slideUp('slow');
$('#payment-method .checkout-content').slideDown('slow');
$('#shipping-method .checkout-heading a').remove();
$('#payment-method .checkout-heading a').remove();
$('#shipping-method .checkout-heading').append('<a><?php echo $text_modify; ?></a>');
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});