Php 它们通过控制器中的一个方法实现,该方法将为从数据库检索的所需数据自定义选择查询。 $(document).ready(function() { $('select[name="governorate"]').on('change
它们通过控制器中的一个方法实现,该方法将为从数据库检索的所需数据自定义选择查询。Php 它们通过控制器中的一个方法实现,该方法将为从数据库检索的所需数据自定义选择查询。 $(document).ready(function() { $('select[name="governorate"]').on('change,php,laravel,Php,Laravel,它们通过控制器中的一个方法实现,该方法将为从数据库检索的所需数据自定义选择查询。 $(document).ready(function() { $('select[name="governorate"]').on('change', function() { var governorateID = $(this).val(); if (governorateID) { $.ajax({
$(document).ready(function() {
$('select[name="governorate"]').on('change', function() {
var governorateID = $(this).val();
if (governorateID) {
$.ajax({
url: '/getStation/' + governorateID,
type: "GET",
dataType: "json",
success: function(data) {
$('select[name="station"]').empty();
$.each(data, function(key, value) {
$('select[name="station"]').append('<option value="' + key + '">' + value + '</option>');
});
}
});
} else {
$('select[name="station"]').empty();
}
});
});
$("#search").on("click", function() {
var governorate = $('#governorate option:selected').val();
var link = document.getElementById("station").value;
var department = $('#department option:selected').val();
var assetType = $('#assetType option:selected').val();
$.ajax({
url: window.location.href = "getData/" + governorate + link + department + assetType
});
});
public function index(Request $request)
{
if($request->ajax())
{
//South_batinah_hw is example of a table where the I need now to take user selection to comare with
//the values in the table to fetch the correct columns
$data = South_batinah_hw::select('Asset_ID','Asset_Type','Asset_Name','Asset_Location',
'Asset_Owner', 'OEM_Vendor_Name', 'Model_No', 'Serial_No',
'Location_and_Rack_Details', 'A_Availability', 'I_Integrity',
'C_Confidentiality', 'Date_Of_Asset_Deployed',
'Date_Of_Asset_Decommissioned',
'Date_of_End_of_Life', 'Maintenance_Status', 'SLA', 'Purpose')::where('station_id', $station_id)
->where('department_id', $department_id)
->where('assets_id',$assetType_id)->get();
return DataTables::of($data)
->addColumn('action', function($data){
$button = '<button type="button" name="edit" id="'.$data->id.'" class="edit btn btn-primary btn-sm">Edit</button>';
$button .= ' <button type="button" name="edit" id="'.$data->id.'" class="delete btn btn-danger btn-sm">Delete</button>';
return $button;
})
->rawColumns(['action'])
->make(true);
}
return view('search.data');
}
<th width="7%">Asset_ID</th>
<th width="5%">Asset Type</th>
<th width="5%">Asset Name</th>
<th width="2%">Asset Location</th>
<th>Asset Owner</th>
<th width="2%">OEM Vendor Name</th>
<th width="3%">Model No</th>
<th width="3%">Serial No</th>
<th width="20%">Location and Rack Details</th>
<th>Availability</th>
<th>Integrity</th>
<th>Confidentiality</th>
<th width="2%">Asset Deployed Date</th>
<th width="2%">Asset Decommissioned Date</th>
<th>Expiring Date</th>
<th width="2%">Maintenance Status</th>
<th>SLA</th>
<th width="5%">Purpose</th>
<th width="10%">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
</tr>
</tfoot>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
let payload = {
fname: this.fname,
lname:this.lname,
email: this.email,
comments: this.comments,
emailTo: this.manager,
clubName: this.club_slug
};
$.ajax({
type: 'POST',
url: `${this.transit_url}/some/route`,
data: payload,
success: function(r) {
console.log('Response from Server - ', r);
},
error: function (e) {
console.log('Response from Server - ', e);
},
});