change button text in js/ajax after mp4 =>mp3 conversion in php

前端 未结 2 1600
猫巷女王i
猫巷女王i 2020-12-12 08:22

I am working on html table rows (which is two at this moment) as shown below in which on button click:

=> JS/jQuery

2条回答
  •  独厮守ぢ
    2020-12-12 08:45

    Try changing this:

    $.ajax({
                url: 'convert.php',
                type: 'POST',
                data: {id: target}, //change to what you want
                success: function(res)
                {   
                },
                error: function(res)
                {
                }
            })
    

    To this:

    $.ajax({
            url: 'convert.php',
            type: 'POST',
            data: {id: target}, //change to what you want
            success: function(res)
            {   
    //You can add $(".go-btn").html('completed'); to here, but I prefer the other way.
            },
            error: function(res)
            {
    // This is unnecessary if you are not gonna make it do anything if error occurs.
            }
        }) 
    .done(function(data) {
    $('.go-btn').html('Completed!');
    //This fires when AJAX call suceeds the process. As a side note, "data" is what your .php code outputs, so you can do whatever you want to do with it.
    });
    

    And also see my comments. I hope this helps.

提交回复
热议问题