[Q] Why the alert(datas); in the below doesn't show up? Why???
But the alert(datas); shows up if $("#post_button").click(function(){ is placed as the first function.
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title> Why not? </title>
<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script language="javascript" src="jquery.timers-1.0.0.js"></script>
<link rel="stylesheet" type="text/css" href="chat_css.css">
<script type="text/javascript">
$(document).ready(function() {
$('.link').click(function(){
var elem = $(this);
$.ajax({
type: "GET",
url: "patest.php",
data: "id="+elem.attr('data-artid'),
success: function(data) {
$('#right_td').html(data);
}
});//$.ajax
});
$("#right_td").delegate("tr td", "click", function () {
var cid = $(this).attr('class');
var tdcid = "td." +cid;
});
$(".refresh").everyTime(2300,function(i){
$.ajax({
type: "POST",
url: "refresh.php",
cache: false,
success: function(html){ //성공후 출력하지 말고, 배열로만 저장???
$(".refresh").html(html);
}
});//ajax
return false;
});// $(".refresh")
$("#post_button").click(function(){ // if this go first and before the $('.link').click(function(){
var datas = $("#textb").val();
alert(datas);
}); //post_button
});
</script>
</head>
<body>
<div class="refresh">
<input name="message" type="text" id="textb" value =""/>
<button id="post_button">submit</button>
</body>
</html>