view like this:
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Brand Name</label>
<div class="col-sm-8">
<select class="form-control" id="brand_mod" name="brand_name" required>
<option value="" selected disabled="disabled">Select Brand Here</option>
<?php foreach($b->result() as $row) { ?>
<option value="<?php echo $row->id; ?>"> <?php echo $row->brand_name; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Model</label>
<div class="col-sm-8">
<select name="model_number" class="form-control" id="models">
<option value="">--Select model --</option>
</select>
</div>
</div>
</div>
</div>
in brand name dropdown brand names are properly visible below that there is my model name dropdown... i want when i click on any brand name its models get displayed on model dropdown
then my ajax call is
<script>
$('#brand_mod').change(function(){
var bbb = $('#brand_mod').val();
//alert(bbb);
$.ajax({
type: "GET",
url: '#Url.Action("<?php echo base_url(); ?>User/get_models", "Application")',
contentType: "application/json; charset=utf-8",
data: { brand_id : $('#brand_mod').val() },
dataType: "json",
cache: false,
success: function(data)
{
alert(data);
alert('Success');
return false;
},
error:function()
{
alert('error');
return false;
}
});
});
</script>
then my controller is like this to which ajax call is made
public function get_models(){
$id = $this->input->post('brand_id');
$this->load->model("user/User_model");
$result1 = $this->User_model->all_models($id);
//$data = array();
'<option value=""></option>'
foreach($result1 as $row)
{
'<option value="'.$row->id'">'.$row->model_name'</option>'
}
}
and my model is
public function all_models($id)
{
$this->db->where('brand_id',$id);
$query = $this->db->get('wc_models');
return $query->result_array();
}
but i am getting error alert.... something is wrong with code... i have tried my best... please help...
Related
I have 3 tables say:-
invoice_details, customer_details and bill_address.
The invoice form has a dropdown and a checkbox. Customer names are listed in the dropdown from the customer table. And when I select a customer name the checkbox values must have the corresponding billId.
so when I mark the checkbox, the value of checkbox must be the billId of that customer name that has been selected. I hope my question is clear.
view page:-
<div class="row space">
<label class="control-label">Customer <span class="manda">*</span></label>
<select class="form-control" name="customerId" id="customerId">
<option value="0">Choose....</option>
<?php
if ($customer) {
foreach ($customer as $row) {
echo "<option value='".$row->customerId."'>".$row->customer_name."</option>";
}
} ?>
</select>
</div>
<div class="row space">
<div class="col-sm-6">
<input type="checkbox" name="checkbox" value="bill">
<label>Bill To</label>
</div>
</div>
How could I do this? please help me...
customerId is common in all 3 tables.
Table details:-
bill_address(billId, customerId, street, city, state, country).
customer_details(customerId, customer_name, phone, email,..).
invoice_details(invoiceId, customerId, billId, date, status,..).
view page of Invoice Form:-
<div class="row space">
<label class="control-label">Customer Name<span class="manda">*</span></label>
<select class="form-control" name="customerId" id="customerId">
<option value="0">Choose Customer Name</option>
<?php
if ($customer) {
foreach ($customer as $row) {
echo "<option value='".$row->customerId."'>".$row->customer_name."</option>";
}
}
?>
</select>
</div>
<div class="row space">
<div class="col-sm-6">
<div id='billData'></div>
</div>
</div>
Jquery Ajax Code:- Add this code in Invoice Form view Page before closing </body> Tag.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#customerId").on("change",function(){
var customerId = $(this).val();
$.ajax({
url : "<?php echo base_url('controler_Name/get_data_in_bill_checkbox') ?>",
type: "post",
data: {"customerId":customerId},
success : function(data){
//alert(data);
$("#billData").html(data);
}
});
});
});
</script>
Contoller Code:-
public function get_data_in_bill_checkbox(){
$customerId = $this->input->post("customerId");
$BillTableDta = $this->db->get_where('bill_address',array('customerId'=>$customerId))->row_array();
$billData = "<label>Bill To</label>";
foreach($BillTableDta as $bill)
{
$billData.='<input type="checkbox" name="billcheckbox" value="'.$bill.'">';
}
echo $billData;
}
Note:- For more Reference see this https://api.jquery.com/change/
You can use the following let me know if it worked using the triangle.:-)
<div class="row space">
<form action="" method="POST">
<label class="control-label">Customer <span class="manda">*</span></label>
<select class="form-control" name="customerId" onchange="this.form.submit()" id="customerId">
<option value="0">Choose....</option>
<?php
if ($customer) {
foreach ($customer as $row) {
echo "<option value='".$row->customerId.'/'.$row->customer_name."'>".$row->customer_name."</option>";
}
}
?>
</select>
<?php
if(isset($_POST['customerID'])){
$true=checked;
$data=explode("/",$_POST['customerID']);
$id=$data[0];
$name=$data[1];
}
else {
$true="";
}
?>
</div>
<div class="row space">
<div class="col-sm-6">
<input type="checkbox" <?php if(isset($true){ echo $true; } ?> name="checkbox" value="<?php if(isset($id){ echo $id; } ?>"> <!-- you can change this $id to $name based on your need.-->
<label><?php if(isset($name) { echo $name; } ?></label>
</div>
</div>
</form>
If I select item name then automatically change price in unit price text box.
But the problem is if I edit the unit price and change again item name, price not change according to item name. Last edited value of unit price display for every item name. What is the solution for this.
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Item Name</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<select class="form-control select2" class="form-control" onchange="fetch_select(this.value);">
<option selected="selected">Select a Category</option>
<?php
$select = mysqli_query($con, "select ItemName from bincard group by ItemName");
while ($row = $select->fetch_assoc()){
echo "
<option value=".$row['ItemName'].">".$row['ItemName']."</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Unit Price</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<textarea rows="1" cols="1" style="resize: none;" class="form-control select2"
class="form-control" id="UnitPrice" name="UnitPrice"></textarea>
</div>
</div>
<script type="text/javascript">
function fetch_select(val) {
$.ajax({
type: 'post',
url: 'fetch_data.php',
data: {
get_option: val
},
success: function(response) {
document.getElementById("UnitPrice").innerHTML = response;
}
});
}
</script>
****** fetch_data.php ******
<?php
include ("common/DBCon.php");
if (isset($_POST['get_option']))
{
$ECatagory = $_POST['get_option'];
$find = mysqli_query($con, "select SellingPrice from bincard where ItemName='$ECatagory'");
while ($row = $find->fetch_assoc())
{
echo "" . $row['SellingPrice'] . "";
}
exit;
}
?>
I think you must set id to select box and try:
$(function(){
$("#your select id").change(function(){
fetch_select($(this).val());
});
});
I want to update my table using bootstrap dialog , but I when I retrieve my datatable from server side and embed php code into my modal to show the table data into the modal, and choose what the user wants to update in that form. it is showing the data from every row of my table into the modal , how can I fix it?
form_modal
<form id="product_update">
<div class="row">
<div class="form-group">
<?php foreach ($product as $value): ?>
<div class="col-xs-12">
<label for="description">Name: </label>
<input type="text" class="form-control" id="description" name="description" title="product description" value="<?php echo $value['descripcion']; ?>" required>
<div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-xs-8 col-sm-6">
<label for="cost_price">Cost Price:</label>
<div class="input-group"> <span class="input-group-addon">$</span>
<input type="text" class="form-control input-group-lg reg_name" id="cost_price" name="cost_price" title="cost_price" placeholder="Last name" value="<?php echo $value['precio_compra']; ?>" required>
</div>
</div>
<div class="col-xs-8 col-sm-6">
<label for="selling_price">Selling price: </label>
<input type="text" class="form-control input-group-lg reg_name" id="selling_price" name="selling_price" title="selling_price" placeholder="Last name" value="<?php echo $value['precio_venta']; ?>" required>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-xs-8 col-sm-6">
<label for="wprice">Wholeprice: </label>
<input type="text" class="form-control" id="wprice" name="wprice" title="wprice" value="<?php echo $value['precio_mayoreo']; ?>" required>
</div>
<div class="col-xs-8 col-sm-6">
<label for="min_stock">Min stock: </label>
<input type="text" class="form-control" id="min_stock" name="min_stock" title="min_stock" value="<?php echo $value['existencia_minima']; ?>" required>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-xs-8 col-sm-6">
<label for="stock">Stock: </label>
<input type="text" class="form-control" id="stock" name="stock" title="stock" value="<?php echo $value['existencia']; ?>" required>
</div>
<div class="col-xs-8 col-sm-6">
<label for="max_stock">Max stock: </label>
<input type="text" class="form-control" id="max_stock" name="max_stock" title="max_stock" value="<?php echo $value['existencia_maxima']; ?>" required>
</div>
</div>
</div>
<?php endforeach ?>
<div class="row">
<div class="form-group">
<div class="col-xs-8 col-sm-6">
<label for="provider">Provider: </label>
<select name="select-provider" id="select-provider">
<option value="0">Select a provider</option>
<?php foreach ($data as $value): ?>
<option value="<?php echo $value['id']; ?>"><?php echo $value['first_name'].' '.$value['last_name'] ?></option>
<?php endforeach ?>
</select>
</div>
</div>
</div>
</form>
modal js
$('#example tbody').on('click', 'a', function(event) {
event.preventDefault();
var data = table.row($(this).parents('tr')).data();
hash = data[0];
$("#product_update").validate();
BootstrapDialog.show({
type: BootstrapDialog.TYPE_WARNING,
message: function(dialog) {
var $message = $('<div></div>');
var pageToLoad = dialog.getData('pageToLoad');
$message.load(pageToLoad);
return $message;
},
data: {
'pageToLoad': URL_GET_VIEW_PRODUCT_UPDATE
},
closable: false,
buttons: [{
id: 'btn-ok',
cssClass: 'btn-primary',
icon: 'glyphicon glyphicon-send',
label: ' Save',
action: function(e) {
var description = $('#description').val();
var description = $('#description').val();
var cost_price = $('#cost_price').val();
var selling_price = $('#selling_price').val();
var wprice = $('#wprice').val();
var min_stock = $('#min_stock').val();
var stock = $('#stock').val();
var max_stock = $('#max_stock').val();
var provider_id = $('#select_provider').val();
if ($("#product_update").valid()) {
$.ajax({
url: URL_GET_UPDATE_PRODUCT,
type: 'POST',
data: { hash: hash, provider_id: provider_id, description: description, cost_price: cost_price, selling_price: selling_price, wprice: wprice, min_stock: min_stock, stock: stock, max_stock: max_stock },
success: function(data) {
console.log(data);
if (data.msg == 'successfully updated') {
$('#product_update')[0].reset();
table.ajax.reload();
} else if (data.min_stock == 'el stock no puede ser mayor al min') {
BootstrapDialog.show({
type: BootstrapDialog.TYPE_DANGER,
message: 'el stock no puede ser mayor al min'
});
}
}
});
}
}
},{
id: 'btn-cancel',
cssClass: 'btn-danger',
icon: 'glyphicon glyphicon-remove',
label: ' Cancel',
action: function(e) {
e.close();
}
}]
});
});
model product
public function datatable(){
$this->db->select('hash_id,codigo,descripcion,precio_compra,precio_venta,precio_mayoreo,existencia_minima,existencia,existencia_maxima,storelte_articulos.status');
$this->db->from('storelte_articulos');
$query = $this->db->get();
return $query->result_array();
}
public function isExistsProduct($data){
$this->db->select('descripcion');
$this->db->from('storelte_articulos');
$this->db->where('descripcion',$data['descripcion']);
$query = $this->db->get();
return $query->num_rows() == 0 ? false : true;
}
public function addProduct($data){
$query = 'UPDATE storelte_articulos SET hash_id = MD5(id) WHERE id = LAST_INSERT_ID()';
$this->db->insert('storelte_articulos',$data);
$this->db->query($query);
}
public function updateProduct($data) {
$this->db->where('md5(id)',$this->input->post('hash'));
$this->db->update('storelte_articulos',$data);
}
public function get_product() {
$this->db->select('codigo,descripcion,precio_compra,precio_venta,precio_mayoreo,existencia_minima,existencia_maxima,existencia');
$this->db->from('storelte_articulos');
$this->db->where('md5(id)', $this->input->post('hash'));
$query = $this->db->get();
return $query->result_array();
}
modal img
I suspect your query is not targeting the single row that you intend to access.
If you are not querying on your table Primary/Unique Key, you should add LIMIT 1 --but really you should be using the PK.
Also, you seem to be looping through all of the results from the query.
You'll need to post more of your code, because I can only make assumptions from what you've provided.
Why are you putting the Warning element at the top?
Where did you copy/paste your scripts from?
public function datatable(){
$this->db->select('hash_id,codigo,descripcion,precio_compra,precio_venta,precio_mayoreo,existencia_minima,existencia,existencia_maxima,storelte_articulos.status');
You will need some sort of $this->db->where() statement here that references the appropriate row id.
like: $this->db->where('id',$this->input->post('id'));
$this->db->from('storelte_articulos');
$query = $this->db->get();
return $query->result_array();
}
$this->db->select('hash_id,codigo,descripcion,precio_compra,precio_venta,precio_mayoreo,existencia_minima,existencia,existencia_maxima,storelte_articulos.status');
You should add WHERE clause here. Basically you are selecting all rows if you don't add any kind of filtering in that clause. For example:
$this->db->select('hash_id,codigo,descripcion,precio_compra,precio_venta,precio_mayoreo,existencia_minima,existencia,existencia_maxima,storelte_articulos.status' WHERE hash_id='YOURHASHID')
I have two pages add_admin.php and ajax_admin.php when i select name in dropdown it display FIRSTNAME, MIDDLENAME and LASTNAME in TEXTBOXES.
HERE is My Code:
add_admin.php
<!-- Department -->
<div class="col-xs-12 col-sm-12 col-md-12" >
<div class="form-group">
<select id="faculty_name" name="faculty_name" class="form-control" onchange='fetch_select(this.value)' required>
<option selected="selected" disabled="disabled">Please Select Faculty</option>
<?php
$query = mysql_query("select * from faculty_details");
while($row = mysql_fetch_array($query))
{
?>
<option value="<?php echo $row['FACULTY_ID'];?>"><?php echo $row['FIRSTNAME']." ".$row['MIDDLENAME']." ".$row['LASTNAME'];?></option>
<?php
}
?>
</select>
</div>
</div>
<!-- First Name -->
<div class="col-xs-12 col-sm-4 col-md-4">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-fw fa-user"></i></div>
<input type="text" id="fname" name="fname" class="form-control input-md" placeholder="First Name" value="">
</div>
</div>
</div>
other text box are there contaisn middlename, lastname
Ajax Code
function fetch_select(val)
{
$.ajax
({
type: 'post',
url: 'ajax_admin.php',
data:
{
get_option:val
},
success: function (response)
{
$('#fname').val(response);
}
});
ajax_admin.php
<?php
if(isset($_POST['get_option']))
{
$state = $_POST['get_option'];
$find=mysql_query("select * from faculty_details where FACULTY_ID=$state");
while($row=mysql_fetch_array($find))
{
echo "$row[FIRSTNAME]";
}
}
?>
Get the result as json from the server so that you can easily use it in jQuery:
ajax-admin.php
if(isset($_POST['get_option']))
{
$state = $_POST['get_option'];
$row1=array();
$find=mysql_query("select firstname,middlename,lastname from faculty_details where FACULTY_ID=$state");
while($row=mysql_fetch_array($find))
{
$row1[]=$row;
}
die(json_encode($row1));
}
Ajax Code
function fetch_val(val) {
$.ajax({
url:"ajax-admin.php",
type:"POST",
data:{"get_option":val},
dataType:"JSON",
success:function(data){
$('#fname').val((data[0].firstname));
$('#mname').val((data[0].middlename));
$('#lname').val((data[0].lastname));
}
});
}
I have this html code.
<form class="" role="form">
<div class="col-lg-2">
<div class="form-group">
<label for="streams">Select Stream</label>
<select name="streams" id="streams" class="form-control">
<option value="">-- Select --</option>
<?php
while($streamRow = mysql_fetch_array($streamResult)) {
echo
"<option value=".$streamRow[0].">".$streamRow[1]."</option>";
}
?>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label for="branches">Select Branch</label>
<select name="branches" id="branches" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label for="batches">Select Batch</label>
<select name="batches" id="batches" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group divBefore">
<label for="divisionBefore">Div</label>
<select name="divisionBefore" id="divisionBefore" class="form-control">
<option value="">Sel</option>
</select>
</div>
<div class="form-group divAfter hide">
<label for="division">Div</label>
<select name="division" id="division" class="form-control">
<option value="">Sel</option>
<?php
$divisionResult = mysql_query("SELECT * FROM division");
while($divisionRow = mysql_fetch_array($divisionResult)) {
echo
"<option value=".$divisionRow[0].">".$divisionRow[1]."</option>";
}
?>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group semesterBefore">
<label for="semBefore">Sem</label>
<select name="semBefore" id="semBefore" class="form-control">
<option value="">Sel</option>
</select>
</div>
<div class="form-group semesterAfter hide">
<label for="sem">Sem</label>
<select name="sem" id="sem" class="form-control">
<option value="">Sel</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group subject">
<label for="subject">Select Subject</label>
<select name="subject" id="subject" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<!--<div class="col-lg-2" id="lecBefore">
<div class="form-group">
<label for="subject">Select Lecture</label>
<select name="lect" id="lect" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2 hide" id="lecAfter">
<div class="form-group">
<label for="subject">Select Lecture</label>
<select name="lecture" id="lecture" class="form-control">
<option value="">-- Select --</option>
<option value="1">Lecture 1</option>
<option value="2">Lecture 2</option>
<option value="3">Lecture 3</option>
<option value="4">Lecture 4</option>
<option value="5">Lecture 5</option>
<option value="6">Lecture 6</option>
<option value="7">Lecture 7</option>
<option value="8">Lecture 8</option>
</select>
</div>
</div>-->
<div class="col-lg-2 hide" id="date">
<div class="form-group">
<label for="dateNow">Start Date</label> <br>
<div class="input-group date" id="avsDate">
<input type="text" class="form-control" name="avsDateTxt" id="avsDateTxt" readonly value="<?php echo date('d-m-Y');?>"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="col-lg-2 hide" id="date1">
<div class="form-group">
<label for="dateNow">End Date</label> <br>
<div class="input-group date" id="endDate">
<input type="text" class="form-control" name="endDateTxt" id="endDateTxt" readonly value="<?php echo date('d-m-Y');?>"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
</form>
and my jquery is.
$(document).ready(function() {
$('.sidebar-menu .attnd').addClass('active');
$('.sidebar-menu .attnd .genExcel').addClass('active');
$(".sidebar-menu .attnd").tree();
$('#streams').change(function() {
$('#branches').html("<option value=''>-- Select --</option>");
$('#batches').html("<option value=''>-- Select --</option>");
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.streamSelection($(this).val());
});
$('#branches').change(function() {
$('#batches').html("<option value=''>-- Select --</option>");
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.branchSelection($(this).val());
});
$('#batches').change(function() {
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '') {
$.listSemester($(this).val());
$('.divBefore').hide();
$('#division').val('');
$('.divAfter').show();
}
});
$('#division').change(function() {
$('.studList').hide();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '') {
$('.semesterBefore').hide();
$('#sem').val('');
$('.semesterAfter').show();
}
});
$('#sem').change(function() {
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.searchSubject();
});
$('#subject').change(function() {
if($(this).val() != '') {
$.when($('#date').show())
.then($('#date1').show())
.then($('.btnExcel').show());
}
});
/*$('#lecture').change(function() {
$.when($('#date').hide())
.then($('#studManip').html(''));
if($(this).val() != '') {
$('#date').show();
$.when($.searchStudent())
.then($('#studManip').show());
}
});*/
$('#avsDate').datepicker({
format: "dd-mm-yyyy",
startDate: "01-01-2012",
endDate: '<?php echo date('d-m-Y')?>',
todayBtn: "linked",
autoclose: true,
todayHighlight: true,
});
$('#endDate').datepicker({
format: "dd-mm-yyyy",
startDate: "01-01-2012",
endDate: '<?php echo date('d-m-Y')?>',
todayBtn: "linked",
autoclose: true,
todayHighlight: true,
});
$('#avsDate').datepicker().on('changeDate', function(e) {
$.when($('.btnExcel').attr('href', 'studExcel.php?streamId='+$('#streams').val()+'&branchId='+$('#branches').val()+'&batchId='+$('#batches').val()+'&divisionId='+$('#division').val()+'&semId='+$('#sem').val()+'&sDate='+$('#advDatetxt').val()+'&eDate='+$('#endDatetxt').val()))
.then($('.btnExcel').show());
});
$('#endDate').change(function() {
$.when($('.btnExcel').attr('href', 'studExcel.php?streamId='+$('#streams').val()+'&branchId='+$('#branches').val()+'&batchId='+$('#batches').val()+'&divisionId='+$('#division').val()+'&semId='+$('#sem').val()+'&sDate='+$('#advDatetxt').val()+'&eDate='+$('#endDatetxt').val()))
.then($('.btnExcel').show());
});
/*var date = new Date();
$('#avsDate').datepicker().on('changeDate', function(e) {
$('#studManip').html('');
if(weekday[$(this).datepicker('getDate').getUTCDay()] != 'Sunday'){
$.when($.searchStudent())
.then($('#studManip').show());
} else
alert('Today is Sunday');
});*/
});
$.streamSelection = function(selStreamId) {
$.ajax({
url:"../student/searchBranch.php",
data:{
streamId:selStreamId,
},
success: function(data) {
$('#branches').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.branchSelection = function(selBranchId) {
$.ajax({
url:"../student/searchBatch.php",
data:{
branchId:selBranchId,
},
success: function(data) {
$('#batches').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.listSemester = function(selStreamId) {
$.ajax({
url:"../student/searchStream.php",
data:{
streamId:selStreamId,
},
success: function(data) {
$('#sem').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.searchSubject = function() {
$.ajax({
url:"searchSubject.php",
data:{
streamId : $('#streams').val(),
branchId : $('#branches').val(),
semId : $('#sem').val(),
},
success: function(data) {
$('#subject').html(data);
},
error: function(error) {
alert(error);
}
});
}
every thing is working fine but when I change advDatetxt or endDatetxt jquery won't sending value with query string and describe as indefined. When I put cursor on excel button it will display left bottom corner as.
I think problem is only spell mistakes
<input type="text" class="form-control" name="avsDateTxt" id="avsDateTxt" readonly value="<?php echo date('d-m-Y');?>">
sDate='+$('#advDatetxt').val()
Here spell mistake in id value, change it as
sDate='+$('#avsDatetxt').val()
next one :
<input type="text" class="form-control" name="endDateTxt" id="endDateTxt" readonly value="<?php echo date('d-m-Y');?>">
eDate='+$('#endDatetxt').val()
Here also spell mistake, change it as
eDate='+$('#endDateTxt').val()
Some of your IDs don't match with the selectors.
See this
id="avsDateTxt"
against
$('#advDatetxt')