How to put ajax request inside function and call it when necessary? – Jquery ajax
I have an ajax request: $.ajax({ type: 'POST', url: '/get-result.php', dataType: 'json', data: 'pid=' + $(this).attr("id"), success: function(response) { $(".reviewee-fname").append(response['fname']); $(".reviewee-lname").append(response['lname']); } }); }; I want to be able to put this inside a function that waits for me to…