1(function ($) { 2 'use strict'; 3 $(document).ready(function () { 4 5 6 $('.compu_repair_form').each(function() { 7 let formDiv = $(this); 8 9 let mainCat = formDiv.find('.main_product_list'); 10 let subCat = formDiv.find('.comp_rep_sub_cat'); 11 let postList = formDiv.find('.comp_rep_post_list'); 12 let postDetails = formDiv.find('.show_post'); 13 let loading = formDiv.find('.loading'); 14 let ajaxUrl = compu.ajax_url 15 function init() { 16 postDetails.html(`<div class="compu_repair_details"> <h3>- - â¬</h3> </div>`) 17 loading.show(); 18 19 } 20 21 subCat.val('').prop('disabled', true).html('<option disabled selected>Serie</option>'); 22 postList.val('').prop('disabled', true).html('<option disabled selected>Art der Dienstleistung</option>'); 23 24 mainCat.on('change', function () { 25 init() 26 postList.val('').prop('disabled', true).html('<option disabled selected>Art der Dienstleistung</option>') 27 let term_id = $(this).val() 28 $.post(ajaxUrl, { 29 'action': 'compu_repair_get_texonomies', 30 'term_id': term_id, 31 nonce: compu.nonce, 32 }, function (data) { 33 let obj = jQuery.parseJSON(data); 34 loading.hide(); 35 if (obj.length > 0) { 36 subCat.val('').prop('disabled', false).html('<option disabled selected>Serie</option>'); 37 let tax_option = ''; 38 for (let i = 0; i < obj.length; i++) { 39 subCat.append(`<option value="${obj[i].term_id}" data-slug="${obj[i].slug}">${obj[i].name}</option>`) 40 } 41 42 } 43 44 45 }) 46 }) 47 48 // Query posts under that category 49 50 subCat.on('change', function () { 51 init() 52 let sub_term_id = $(this).val() 53 let sub_term_slug = $(this).find(':selected').data('slug') 54 55 $.ajax({ 56 url: ajaxUrl, // WordPress AJAX URL 57 type: 'POST', data: { 58 action: 'compu_repair_get_posts', 'term_id': sub_term_id, 'term_slug': sub_term_slug, nonce: compu.nonce 59 }, success: function (response) { 60 let posts = jQuery.parseJSON(response); 61 loading.hide(); 62 63 if (posts.length > 0) { 64 postList.val('').prop('disabled', false).html('<option disabled selected>Art der Dienstleistung</option>') 65 let tax_option = ''; 66 67 for (let i = 0; i < posts.length; i++) { 68 postList.append(`<option value="${posts[i].id}">${posts[i].title}</option>`) 69 } 70 } 71 }, error: function (errorThrown) { 72 console.log('Error: ' + errorThrown); 73 } 74 }); 75 76 77 }) 78 79 // Get Post Details 80 81 postList.on('change', function () { 82 init() 83 let post_id = $(this).val() 84 85 $.ajax({ 86 url: ajaxUrl, // WordPress AJAX URL 87 type: 'POST', data: { 88 action: 'compu_repair_get_post_details', 'post_id': post_id, nonce: compu.nonce 89 }, success: function (response) { 90 let post_details = jQuery.parseJSON(response); 91 loading.hide(); 92 postDetails.show() 93 postDetails.html(`<div class="compu_repair_details"> <h3>${post_details.price}</h3> </div>`) 94 95 }, error: function (errorThrown) { 96 console.log('Error: ' + errorThrown); 97 } 98 }); 99 100 101 }) 102 103 }) 104 105 106 107 }) 108 109 110}
110)(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.