HTML (ajax.html)
<html>
<head>
<title>Jquery ajax</title>
</head>
<script src="http://code.jquery.com/jquery-1.3.2.min.js"></script>
<script>
function dojqueryajax(coba){
$.post('ajax.php', {coba:coba}, function (data){
$('#hasil').text(data);
});
}
</script>
<body>
<a href="javascript:;" onclick="dojqueryajax('berhasil');">coba</a>
<div id="hasil"></div>
</body>
</html>
PHP (ajax.php)
<?php
echo $_POST['coba'];
?>
Tidak ada komentar:
Posting Komentar
Leave a message