HTML Code
<script language="javascript" src="js/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(function(){
$("#btShowtime").click(function(){ // event เมื่อปุ่มถูกคลิก
var html = $.ajax({ // สร้างตัวแปร html เพื่อเก็บค่า html ที่ได้จากการเรียกใช้ ajax
url: "jquery_ajax_test.php"
}).responseText;
$("#showtime").html(html); // นำค่าในตัวแปร html ไปแสดงใน div ที่มี id เท่ากับ showtime
});
});
</script>
<div id="showtime"></div>
<input name="btShowtime" type="button" id="btShowtime" value="Button" />
jquery_ajax_text.php
<?php
header("Content-Type: text/html; charset=TIS-620");
echo date("d-m-Y H:i:s");
?>