If you use $(this) within the ajax code it will not find the element you need.
Get the element at the beginning using (this) and create a variable of it. Then you can late refer to this variable in the ajax part.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script> $(document).ready(function(){ // button click to go to client $(document).on('click', '.updateseotime', function() { var myblock = $(this).closest("td").find(".editseotime"); //get the part you want to refer to within ajax var clientid = $(this).attr('data-client'); $.ajax({ url: "update.php", dataType: "html", type: 'POST', data: "clientid="+clientid, success: function(data){ $(myblock).text("I will change"); //use new reference to change without using (this) } }); }); }); </script> |