I want to append first, then run ajax to update the data and then do the search. See the code below. I want to put a code like if append, then run $.post. How can I do that in jquery, thanks?
$('<span />', { class: 'result_tag', text: href }).insertBefore($input);
$('.result_tag').append(' ');
//make sure append first and then run .post
$.post("member_search.php", {
search_text: $(".result_tag").text()
}).done(function()
{
$.post("member_search.php", {
search_text: $(".result_tag").text()
},
function(data){
$("#find_members").html(data);
});
});