I am working on jQuery/AJAX code as shown below which calls convert.php script.
jQuery(document).ready(function($)
{
$('.go-btn').click(function()
{
let target = $(this).attr('data-id'),
spanEl = $('.file-name[data-id='+ target +']');
$.ajax({
url: 'convert.php',
type: 'POST',
data: {id: target}, //change to what you want
success: function(res)
{
console.log("Tested");
},
error: function(res)
{
}
})
})
});
In convert.php script conversion of mp4 into mp3 is happening. Once the conversion is complete, on console Tested is printed.
Problem Statement:
I am wondering what changes I should make in jQuery/AJAX code above so that once the conversion is complete, the button text belonging to the HTML code below gets change to Completed
The above jQuery/AJAX code is called on button click. Here is the snippets of HTML code belonging to the button:
HTML Code:
<?php foreach ($programs as $key => $program) { ?>
<tr data-index="<?php echo $key; ?>">
<td><input type="submit" name="go-button" value="Go" data-id="<?php echo $key; ?>" ></input></td>
</tr>
<?php }?>
success:$('.go-btn').val('Completed');success- same place as you are writing "tested" to the console.success: function(res) { $('.go-btn').val('Completed'); },