| 1 |
jQuery(document).ready(function ($) { |
| 2 |
$(".sdevs-loading-icon").hide(); |
| 3 |
|
| 4 |
$(".sdevs-install-plugin").click(() => { |
| 5 |
install_woocommerce_plugin(); |
| 6 |
}); |
| 7 |
|
| 8 |
$(".sdevs-activate-plugin").click(() => { |
| 9 |
wps_subscription_activate_woocommerce_plugin(); |
| 10 |
}); |
| 11 |
|
| 12 |
function install_woocommerce_plugin() { |
| 13 |
$.ajax({ |
| 14 |
type: "POST", |
| 15 |
url: sdevs_installer_helper_obj.ajax_url, |
| 16 |
data: { |
| 17 |
install_plugin: "woocommerce", |
| 18 |
action: "subscrpt_install_woocommerce_plugin", |
| 19 |
}, |
| 20 |
beforeSend: function () { |
| 21 |
$(".sdevs-loading-icon").show(); |
| 22 |
}, |
| 23 |
success: function (data) { |
| 24 |
wps_subscription_activate_woocommerce_plugin(); |
| 25 |
}, |
| 26 |
complete: function () { |
| 27 |
console.log("Plugin installed"); |
| 28 |
}, |
| 29 |
}); |
| 30 |
} |
| 31 |
|
| 32 |
function wps_subscription_activate_woocommerce_plugin() { |
| 33 |
$.ajax({ |
| 34 |
type: "POST", |
| 35 |
url: sdevs_installer_helper_obj.ajax_url, |
| 36 |
data: { |
| 37 |
activate_plugin: "woocommerce", |
| 38 |
action: "subscrpt_activate_woocommerce_plugin", |
| 39 |
}, |
| 40 |
beforeSend: function () { |
| 41 |
$(".sdevs-loading-icon").show(); |
| 42 |
}, |
| 43 |
success: function (data) { |
| 44 |
window.location.reload(); |
| 45 |
}, |
| 46 |
complete: function () { |
| 47 |
console.log("Plugin activated"); |
| 48 |
window.location.reload(); |
| 49 |
}, |
| 50 |
}); |
| 51 |
} |
| 52 |
}); |
| 53 |
|