gus_dancy
12/14/2023, 5:37 PMRyan Albrecht
12/14/2023, 5:37 PMRyan Albrecht
12/14/2023, 5:37 PMgus_dancy
12/14/2023, 5:38 PMRyan Albrecht
12/14/2023, 5:38 PMgus_dancy
12/14/2023, 5:39 PMRyan Albrecht
12/14/2023, 5:48 PM<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#myModal">Add Child to this Group Reg</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add Child to this Group Reg</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
<div class="input-group mb-3">
<input type="text" class="form-control" id="last_name" placeholder="Lastname" aria-label="LastN" aria-describedby="basic-addon1">
</div>
<button class="btn btn-default" data-bs-dismiss="modal" id="search_button">Search</button>
</div>
</div>
</div>
</div>
</div>
<script>
// i assume you are using jquery here
$('#search_button').on('click', (evt) => {
var search_term = $('#last_name').val();
$.ajax({
method: 'POST',
url: '/docs/divs/action/act_childSearch.cfm',
data: {
lastName: search_term
},
success: (resp) => {
// hand the resp here by updating the DOM
},
error: (err) => {
//handle you error here
}
})
});
</script>Ryan Albrecht
12/14/2023, 5:48 PMdata-dismiss and data-toggle attributesRyan Albrecht
12/14/2023, 5:48 PMRyan Albrecht
12/14/2023, 5:50 PMRyan Albrecht
12/14/2023, 5:50 PMgus_dancy
12/14/2023, 5:52 PMRyan Albrecht
12/14/2023, 5:53 PMRyan Albrecht
12/14/2023, 5:53 PM<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">Add Child to this Group Reg</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add Child to this Group Reg</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
<div class="input-group mb-3">
<input type="text" class="form-control" id="last_name" placeholder="Lastname" aria-label="LastN" aria-describedby="basic-addon1">
</div>
<button class="btn btn-default" data-dismiss="modal" id="search_button">Search</button>
</div>
</div>
</div>
</div>
</div>
<script>
// i assume you are using jquery here
$('#search_button').on('click', (evt) => {
var search_term = $('#last_name').val();
$.ajax({
method: 'POST',
url: '/docs/divs/action/act_childSearch.cfm',
data: {
lastName: search_term
},
success: (resp) => {
// hand the resp here by updating the DOM
},
error: (err) => {
//handle you error here
}
})
});
</script>gus_dancy
12/14/2023, 5:55 PMgus_dancy
12/14/2023, 5:55 PMRyan Albrecht
12/14/2023, 5:56 PMRyan Albrecht
12/14/2023, 5:56 PMRyan Albrecht
12/14/2023, 5:57 PMgus_dancy
12/14/2023, 5:57 PMRyan Albrecht
12/14/2023, 5:57 PMRyan Albrecht
12/14/2023, 5:57 PMsuccess: (resp) => {
// hand the resp here by updating the DOM
$('#someDivId').html(resp);
},gus_dancy
12/14/2023, 5:57 PMgus_dancy
12/14/2023, 5:58 PMgus_dancy
12/14/2023, 5:58 PMRyan Albrecht
12/14/2023, 5:58 PMgus_dancy
12/14/2023, 7:12 PMRyan Albrecht
12/14/2023, 7:16 PMRyan Albrecht
12/14/2023, 7:16 PM<!--- act_childSearch.cfm --->
<cfquery name="getChildren">
SELECT *
FROM children
WHERE last_name LIKE '%#form.lastName#%'
</cfquery>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>First</th>
<th>Last</th>
<th>Code</th>
</tr>
</thead>
<tbody>
<cfoutput query="getChildren">
<tr>
<td>#getChildren.id#</td>
<td>#getChildren.first_name#</td>
<td>#getChildren.last_name#</td>
<td>#getChildren.code#</td>
</tr>
</cfoutput>
</tbody>
</table>Ryan Albrecht
12/14/2023, 7:18 PM$.ajax call returns, that html will be available in the in the resp object, and you insert that html (plain text) into a div which alters the DOM of the webpageRyan Albrecht
12/14/2023, 7:18 PMgus_dancy
12/14/2023, 7:19 PMRyan Albrecht
12/14/2023, 7:20 PMnetwork tab and search for the http request. You should see what response you are getting.gus_dancy
12/14/2023, 7:20 PMgus_dancy
12/14/2023, 7:21 PMgus_dancy
12/14/2023, 7:21 PMRyan Albrecht
12/14/2023, 7:21 PMact_childSearch.cfmRyan Albrecht
12/14/2023, 7:21 PMform.lastNamegus_dancy
12/14/2023, 7:22 PMRyan Albrecht
12/14/2023, 7:24 PMname attributes are only required when you use a form element. When the form is submitted those will be the names of the keys that are passed to the servergus_dancy
12/14/2023, 7:24 PMgus_dancy
12/14/2023, 7:25 PMgus_dancy
12/14/2023, 7:26 PMRyan Albrecht
12/14/2023, 7:26 PMgus_dancy
12/14/2023, 7:26 PMRyan Albrecht
12/14/2023, 7:27 PMgus_dancy
12/14/2023, 7:42 PMRyan Albrecht
12/14/2023, 7:43 PMRyan Albrecht
12/14/2023, 7:43 PMgus_dancy
12/14/2023, 7:45 PMRyan Albrecht
12/14/2023, 7:46 PMRyan Albrecht
12/14/2023, 7:47 PMmodal-lg to the div with the class modal-dialoggus_dancy
12/14/2023, 8:22 PMgus_dancy
12/14/2023, 8:31 PMRyan Albrecht
12/14/2023, 8:43 PMRyan Albrecht
12/14/2023, 8:44 PM// use this to the hide modal
$('#myModal').modal('hide')
// use this to the show modal
$('#myModal').modal('show')gus_dancy
12/14/2023, 10:08 PMgus_dancy
12/14/2023, 10:09 PMgus_dancy
12/14/2023, 10:35 PMgus_dancy
12/14/2023, 10:36 PMRyan Albrecht
12/15/2023, 1:21 PM