$(document).ready(function(){ //console.log('foo bar'); var d = new Date(); var month = d.getMonth()+1; var day = d.getDate(); var currentDate = d.getFullYear() + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day; /* $('.progressIndicatorCheckbox').change(function() { console.log('food inside'); if(this.checked) { var returnVal = confirm("Are you sure?"); $(this).prop("checked", returnVal); } $('#textbox1').val(this.checked); }); */ function matchCustom(params, data) { // If there are no search terms, return all of the data if ($.trim(params.term) === '') { return data; } // Do not display the item if there is no 'text' property if (typeof data.text === 'undefined') { return null; } // `params.term` should be the term that is used for searching // `data.text` is the text that is displayed for the data object if (data.text.indexOf(params.term) > -1) { var modifiedData = $.extend({}, data, true); modifiedData.text += ' (matched)'; // You can return modified objects from here // This includes matching the `children` how you want in nested data sets return modifiedData; } // Return `null` if the term should not be displayed return null; } $('#shortCodeCountry').select2({ matcher: matchCustom }); $('.progressIndicatorCheckbox').on('change', function() { // From the other examples // console.log('finker'); if (!this.checked) { var sure = confirm("Are you sure?"); this.checked = !sure; $('#textbox1').val(sure.toString()); } }); $("select#shortCodeCountry").change(function(){ var shortCodeCountry = $(this).val(); var theToken = "{{ csrf_token }}"; $.ajax({ type: "POST", url: base_url + '/mnos/getCountryNetworks', headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, data: {"country" : shortCodeCountry }, cache: false, beforeSend: function () { console.log('loader here'); //show a loader here //$('#district').html(''); }, success: function(data) { console.log(data.mnos); // var jason = JSON.parse(data); if (data.code === 1) { var actionPoint = $('#networks').empty(); console.log(actionPoint); $.each(data.mnos, function(key, value) { console.log(id); console.log(row); //$('#networks').append($("