JSFiddle - React, Tailwind, and code Playground
by Suryar Praveen
JavaScript
var cart_actions = {};
cart_actions.empty_cart = {};
jQuery(document).ready(function() {
// Defining empty cart action in topup page
cart_actions.empty_cart.topup = function() {
lyca_cart_topup_open_tab('0');
lock_tabs();
jQuery('#lyca_cart_topup_button1').prop('disabled', true);
//topup_order_details_field_deactivate();
jQuery('#lyca_topup_mobile_no').prop('disabled', false);
grecaptcha.reset();
}
/* add bundle button */
jQuery('.add_bundle_button').click(function() {
var bundle_id = jQuery(this).attr('bundle_id');
//alert(jQuery(this).attr('promo_code'));
if (jQuery(this).is('[promo_code]')) {
var promo_code = jQuery(this).attr('promo_code');
} else {
var promo_code = "";
}
if (jQuery(this).is('[redirect]')) {
var redirect = jQuery(this).attr('redirect');
} else {
var redirect = lca_globals.cart_url;
}
if (jQuery(this).is('[assoc_with]')) {
var assoc_with = jQuery(this).attr('assoc_with');
} else {
var assoc_with = "";
}
jQuery.ajax({
type: "POST",
url: lca_globals.ajax_url,
data: "action=add_to_cart_bundle&bundle_id=" + bundle_id + "&assoc_with=" + assoc_with + "&promo_code=" + promo_code,
success: function(out) {
window.location = redirect;
//window.location = lca_globals.cart_url;
}
});
});
// Delete cart Item
jQuery('body').on('click', '[revomeable]', function() {
if (jQuery(".button_delete_new_sim").hasClass("disableButtonClass")) {
return false;
}
var remove_button = jQuery(this);
var item_id = remove_button.attr('revomeable');
var type = remove_button.attr('type');
var removeType;
if (type != '') {
removeType = 1;
} else {
removeType = 0;
}
//alert(removeType);return false;
jQuery.ajax({
type: "POST",
url: lca_globals.ajax_url,
async: false,
dataType: 'json',
data: {
...