$('.text').click(function(){ var th = this.id $.ajax({ url: "test.php", cache: false, success: function(html){ $("#"+th).html(th); } }); });