Have a interesting problem. I make a little ajax mechanism to get info from php file and add a function for delete the data.
phpfile.php:
<?php
if(isset($_POST['bu'])){
$data = 'text<a onclick="something();" href="#">alert</a>';
echo $data;
}
?>
js file:
function getdatafromfile(){
var bu = 'bu';
$.ajax({
type: 'POST',
url: 'phpfile.php',
data: {bu: bu},
success: function(msg){
$("#msg").html(msg);
getContent();
}
});
}
function something(){
alert("alert");
}
Data from the php file is fine, but when I click on the link (<a onclick="something();" href="#">alert</a>) getted from ajax, function don't work.
How to fix that?
Thanks in advance!