Сообщение от Mikhail1989
|
как в ajax подгружать выполнение скриптов
|
Возвращается некий html, в котором есть и JS выполняемый по загрузке контента:
<?
if($_POST['a']) exit(
'<div id=as></div>
<script>
$(function() {
$("#as").text("Опаньки!").css({color:"#f00"})
});
</script>'
)
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script>
$(function() {
$.post(location, {a:1}, function(d) {
$('body').append(d)
}, 'html')
});
</script>
</head>
<body>
</body>
</html>