php - jquery not working correctly on onchange event attribute of html -


i using jquery data mysql when dropdown selected. runs on local environment loads previous data on server if data not exist in mysql.

<select name="book_no" id="name" class="form-control selectpicker" data-index="2" data-live-search="true"  onchange="$('#amount').load('ajax.php?name=' + $('#name :selected').val());$('#output1').val($(this).find('option:selected').attr('id'));$('#book_series').val($(this).find('option:selected').attr('ids'))"> 

and code in ajax.php file

<?php   include 'include/db.php';   $name = $_request['name'];    ?>    <script>    console.log("hello");    </script>                        <label>slip start</label>                       <?php           $query = "select * book_slip book_code = '$name'" ;           $res = mysqli_query($con , $query);            ?>           <select name="ss" id="names" class="form-control" onchange="$('#amoun').load('ajax1.php?name=' + $('#names :selected').val());">           <option value=""></option>            <?php          while ($row = mysqli_fetch_array($res)){           echo "<option value=$row[id]>$row[book_slip]</option>";         }             echo "</select>";             ?> 

the main purpose of code slips values not used until if slip used deleted database. , when check in database slip not shown showing in form should do.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

Why does math.random(999999999999) returns 1 in Lua? -