PluginProbe
Repeater Fields for Gravity Forms / 2.0.5
Repeater Fields for Gravity Forms v2.0.5
3.2.0 3.1.1 3.1.0 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.5.1 2.5.0 2.4.6 trunk 2.0.5 2.0.9 2.1.0 2.3.2 2.3.7 2.4.1 2.4.3 2.4.4 2.4.5
repeater-for-gravity-forms / superaddons / rednumber_check_purchase_code.js

rednumber_check_purchase_code.js in Repeater Fields for Gravity Forms 2.0.5, at superaddons/rednumber_check_purchase_code.js

47 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($) {
2 "use strict";
3 $( document ).ready( function () {
4 var loading = 0;
5 $("body").on("click",".rednumber-active",function(e){
6 e.preventDefault();
7 if(loading != 0){
8 return ;
9 }
10 var bnt = $(this);
11 bnt.html("Checking...");
12 loading = 1;
13 var ip = $(this).closest('.rednumber-purchase-container').find("input");
14 var purchase_code = ip.val();
15 var data = {
16 'action': 'rednumber_check_purchase_code',
17 'code': purchase_code,
18 'id': ip.data("id")
19 };
20 jQuery.post(ajaxurl, data, function(response) {
21 console.log(response);
22 loading = 0;
23 bnt.html("Active");
24 if( response == "ok" ){
25 $(".rednumber-purchase-container_show").removeClass('hidden');
26 $(".rednumber-purchase-container_form").addClass('hidden');
27 $(".rednumber-purchase-container_show span").html(purchase_code);
28 $(".rednumber-remove").attr("data-code",purchase_code);
29 }else{
30 alert(response);
31 }
32 });
33 })
34 $("body").on("click",".rednumber-remove",function(e){
35 e.preventDefault();
36 var remove = {
37 'action': 'rednumber_check_purchase_code_remove',
38 'id': $(this).data("id"),
39 'code': $(this).data("code"),
40 };
41 jQuery.post(ajaxurl, remove, function(response) {
42 $(".rednumber-purchase-container_form").removeClass('hidden');
43 $(".rednumber-purchase-container_show").addClass('hidden');
44 });
45 })
46 })
47 })(jQuery);