| 1 |
(function($) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
jQuery(document).ready(function($){ |
| 5 |
|
| 6 |
$(document).on("click","#qcpg-query-submit-btn", function(event){ |
| 7 |
|
| 8 |
event.preventDefault(); |
| 9 |
|
| 10 |
$("#support-form-result #support-form-status").hide(); |
| 11 |
$("#qc-support-form #support-form-loading").hide(); |
| 12 |
|
| 13 |
var flag = true; |
| 14 |
|
| 15 |
var name = $("#qc-support-form #name").val(); |
| 16 |
var email = $("#qc-support-form #email").val(); |
| 17 |
var subject = $("#qc-support-form #subject").val(); |
| 18 |
var message = $("#qc-support-form #message").val(); |
| 19 |
var plugin_name = $("#qc-support-form #plugin_name").val(); |
| 20 |
|
| 21 |
if( name == "" || email == "" || subject == "" || message == ""){ |
| 22 |
flag = false; |
| 23 |
} |
| 24 |
|
| 25 |
var atpos = email.indexOf("@"); |
| 26 |
var dotpos = email.lastIndexOf("."); |
| 27 |
|
| 28 |
if ( atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length ) { |
| 29 |
alert("Not a valid e-mail address"); |
| 30 |
flag = false; |
| 31 |
return false; |
| 32 |
} |
| 33 |
|
| 34 |
if( flag ) |
| 35 |
{ |
| 36 |
|
| 37 |
$("#qc-support-form #support-form-loading").show(); |
| 38 |
|
| 39 |
var data = { |
| 40 |
'action': 'process_qc_promo_form', |
| 41 |
'post_name': name, |
| 42 |
'post_email': email, |
| 43 |
'post_subject': subject, |
| 44 |
'post_message': message, |
| 45 |
'post_plugin_name': plugin_name, |
| 46 |
'security': qcld_seo_ajax_nonce |
| 47 |
}; |
| 48 |
|
| 49 |
jQuery.post(qcld_seo_ajaxurl, data, function(response) { |
| 50 |
var json = $.parseJSON(response); |
| 51 |
|
| 52 |
$("#qc-support-form #support-form-loading").hide(); |
| 53 |
|
| 54 |
$("#support-form-result #support-form-status").removeClass('output-success'); |
| 55 |
$("#support-form-result #support-form-status").removeClass('output-failed'); |
| 56 |
$("#support-form-result #support-form-status").hide(); |
| 57 |
|
| 58 |
if( json.status == 'failed' ){ |
| 59 |
$("#support-form-result #support-form-status").show(); |
| 60 |
$("#support-form-result #support-form-status").html(''); |
| 61 |
$("#support-form-result #support-form-status").addClass('output-failed'); |
| 62 |
$("#support-form-result #support-form-status").html('<p>'+json.message+'</p>'); |
| 63 |
} |
| 64 |
|
| 65 |
if( json.status == 'success' ){ |
| 66 |
|
| 67 |
$("#support-form-result #support-form-status").show(); |
| 68 |
$("#support-form-result #support-form-status").html(''); |
| 69 |
$("#support-form-result #support-form-status").addClass('output-success'); |
| 70 |
$("#support-form-result #support-form-status").html('<p>'+json.message+'</p>'); |
| 71 |
|
| 72 |
$("#qc-support-form #name").val(''); |
| 73 |
$("#qc-support-form #email").val(''); |
| 74 |
$("#qc-support-form #subject").val(''); |
| 75 |
$("#qc-support-form #message").val(''); |
| 76 |
} |
| 77 |
|
| 78 |
}); |
| 79 |
|
| 80 |
} |
| 81 |
else |
| 82 |
{ |
| 83 |
alert("Please fill-up the required fields."); |
| 84 |
} |
| 85 |
|
| 86 |
}); |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
$( window ).on( "load", function() { |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
var data = { |
| 95 |
'action': 'qcld_recommend_support_function_first_wpchatbot_ajax', |
| 96 |
'security': qcld_wpchatbot_comments_ajax_nonce |
| 97 |
}; |
| 98 |
|
| 99 |
jQuery.post(qcld_wpchatbot_comments_ajaxurl, data, function (response) { |
| 100 |
|
| 101 |
$('.wpchatbot-comments-support').find('.qcld-plugins-lists').prepend(response); |
| 102 |
|
| 103 |
var data = { |
| 104 |
'action': 'qcld_recommend_support_function_second_wpchatbot_ajax', |
| 105 |
'security': qcld_wpchatbot_comments_ajax_nonce |
| 106 |
}; |
| 107 |
|
| 108 |
jQuery.post(qcld_wpchatbot_comments_ajaxurl, data, function (response) { |
| 109 |
|
| 110 |
$('.wpchatbot-comments-support').find('.qcld-plugins-lists').find('.recommended-plugins').last().after(response); |
| 111 |
|
| 112 |
var data = { |
| 113 |
'action': 'qcld_recommend_support_function_third_wpchatbot_ajax', |
| 114 |
'security': qcld_wpchatbot_comments_ajax_nonce |
| 115 |
}; |
| 116 |
|
| 117 |
jQuery.post(qcld_wpchatbot_comments_ajaxurl, data, function (response) { |
| 118 |
|
| 119 |
$('.wpchatbot-comments-support').find('.qcld-plugins-lists').find('.recommended-plugins').last().after(response); |
| 120 |
|
| 121 |
var data = { |
| 122 |
'action': 'qcld_recommend_support_function_four_wpchatbot_ajax', |
| 123 |
'security': qcld_wpchatbot_comments_ajax_nonce |
| 124 |
}; |
| 125 |
|
| 126 |
jQuery.post(qcld_wpchatbot_comments_ajaxurl, data, function (response) { |
| 127 |
|
| 128 |
$('.wpchatbot-comments-support').find('.qcld-plugins-lists').find('.recommended-plugins').last().after(response); |
| 129 |
$('.qcld-plugins-loading').remove(); |
| 130 |
|
| 131 |
}); |
| 132 |
|
| 133 |
}); |
| 134 |
|
| 135 |
}); |
| 136 |
|
| 137 |
}); |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
}); |
| 143 |
|
| 144 |
|
| 145 |
}); |
| 146 |
|
| 147 |
|
| 148 |
})(jQuery); |