I load an ajax query via two dates on my page which displays a list of calls.
Within the data returned there is CallID, Name, Date, Button to Complete.
I can't seem to get my javascript to fire on the button click after the AJAX call.
First my HTML:
<input type="text" class="form-control date-picker" id="startdate" value="<?php echo date("m/d/Y");?>">
<input type="text" class="form-control date-picker" id="enddate" value="<?php echo date("m/d/Y");?>">
<input type"text" id="rep" value="WOLRAB">
<div id="calls"></div>
Second my AJAX to call data:
$('input#daterange').on('click', function() {
var start = $('input#startdate').val();
var end = $('input#enddate').val();
var rep = $('input#rep').val();
$.post('assets/ajax/repscalls.php', {startdate: start,enddate: end, rep:rep}, function(data) {
$('#calls').html(data)
});
});
Thirdly my php file performing results (note I've only copied in the button that displays on html page after ajax fire.
echo "<td><input type='hidden' id='callid' value='" . $row['callid'] . " '><input type='submit' id='completecall' value='Complete'></td>";
Now once this has been outputted to HTML page, I then want to click the COMPLETE button which updates that call with the status complete.
I was doing this a similar way, but for some reason I can't get my javascript to fire on button click.
$('input#completecall').on('click', function() {
var completeid = $('input#callid').val();
alert(completeid);
});