我遇到的问题是,在“传递方法”部分,Ajax由于某些原因而无法验证。
在下面的代码中(来自签出/checkout.tpl),BeforeSend和complete函数正在启动,但是成功中的函数并不是关闭的。
有人能告诉我'index.php?route=checkout/shipping_method/validate‘在哪里吗?
谢谢
$('#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);
$('#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>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);
}
});
});发布于 2013-08-16 22:48:00
如url所示,控制器结构是您可以在名称为validate的类中找到的ControllerCheckoutShippingMethod函数,该类位于
catalog\controller\checkout\shipping_method.php
发布于 2016-06-03 11:40:07
签出使用许多页面,因为Ajax是
url: 'index.php?route=checkout/shipping_method/validate',它通过函数验证从页面签出/传送_Method.php中检索数据。 和客人退房
checkout/guest.php
public function save() {//this function consist validation
checkout/shipping_method.php
checkout/payment_method.php您可以在firebug中使用控制台进行检查,这将使您清楚地了解通过ajax调用的哪个部分或页面当前正在运行。
https://stackoverflow.com/questions/18283137
复制相似问题