');
}
}
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
var element = $('#input-option' + i.replace('_', '-'));
if (element.parent().hasClass('input-group')) {
element.parent().after('
' + json['error']['option'][i] + '
');
} else {
element.after('
' + json['error']['option'][i] + '
');
}
}
}
if (json['error']['recurring']) {
$('select[name=\'recurring_id\']').after('
' + json['error']['recurring'] + '
');
}
// Highlight any found errors
$('.text-danger').parent().addClass('has-error');
}
if (json['success']) {
$('.breadcrumb').after('');
// Need to set timeout otherwise it wont update the total
setTimeout(function () {
$('#cart > button').html(' ' + json['total'] + '');
}, 100);
setTimeout(function () {
$('#cart_mobile > a').html('' + json['quantity'] + '');
}, 100);
//$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li.desk_cart');
$('#cart_mobile > ul').load('index.php?route=common/cart/info ul li.mob_cart');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
//-->
');
}
}
if (json['error']) {
$(node).parent().find('input').after('