Uncaught ReferenceError: data is not defined in doing a math calculation in jQuery

I am trying to do a math but I am having this data not defined issue. here’s the complete script <script> $(document).ready(function(){ fetch_loan_interest(); function fetch_loan_interest(query = ”) { $.ajax({ url:””, method:’GET’, data:{query:query}, dataType:’json’, success:function(data) { $(‘#label_initial’).text(data.label_initial); $(‘#interest_initial’).text(‘Addition ‘+data.interest_initial+’% interest’); $(‘#trigger_day_count_initial’).text(data.trigger_day_count_initial); } }) } $(document).on(‘change’, ‘#loan_duration_id’, function(){ var query = $(this).val(); fetch_loan_interest(query); }); $(document).on(‘keyup’, ‘#req_amount’, function(){…

Jquery working in console but not in actual code for checkbox enable disable

I have created one checkbox on the click on which the date fields are enabled/disabled this is my code for jquery: $(document).ready(function() { $(“#mychechbox”).click(function(){ $(“#date_1”).attr(“disabled”, !this.checked); }); }); my html tags for same: <input id=”date_1″ value=”<?php echo $this->input->post(‘from’); ?>” name=”from” class=”form-control” type=”date” placeholder=” From” disabled/> <p class=”pull-left” style=”font-size:10px;”> From Date<br><br>Enable Date fiedls <input type=”checkbox” class=”pull-left”…

How to load jQuery in modal bootstrap 4

So I have this code that work well to load 10 extra “article” after click on button that work fin in my page. $(function(){ $(“.trick-show”).slice(0, 10).css(‘display’, ‘flex’); // select the first ten $(“#loadMore”).click(function(e){ // click event for load more e.preventDefault(); $(“.trick-show:hidden”).slice(0, 5).css(‘display’, ‘flex’); // select next 5 hidden tricks and show them if($(“.trick-show:hidden”).length === 0){…

Get JSON key-value pairs by using Jquery SerializeArray()

How to serialize a form What I want [{“itemId[0]”:”143″,”quantity[0]”:”0″}, {“itemId[1]”:”142″,”quantity[1]”:”0″}] Returned output [{“name”:”itemId[0]”,”value”:”143″},{“name”:”quantity[0]”,”value”:”0″}, {“name”:”itemId[1]”,”value”:”142″},{“name”:”quantity[1]”,”value”:”0″}] I knew the question quite similar like jQuery serializeArray() key value pairs, but I still didn’t manage to solve it. My code so far javascript …. for (var i = 0; i < checkboxes.length; i++) { var p1 = ‘<tr><td><input type=”hidden”…

Jquery-ui Auto complete with dynamic input field and multi dimension array in Laravel

I need to add products for sale with dynamic input field. The field use autocomplete from Jquery ui and later I want to fetch both ui.label and ui.value. My dynamic Input Field Code $(document).ready(function () { var count = 1; dynamic_field(count); function dynamic_field(number) { html = ‘<tr><div class=”input_fields_wrap”>’; html += ‘<td><input type=”text” name=”productname[]” class=”form-control producttarget”…