<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width"/>
<meta name="viewport" content="initial-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link type="text/css" href="../../zhuys3/css/table.css" rel="stylesheet" />
<title>查询</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="jquery.min.js"></script>
<script type="text/javascript">
var arrayDate = [ '201708'];
var arrayComm = [ '202.2' ];
var s_m;
// $("tr").click(function(){
function tr_bg_color() {
//$("#tab1>tr").css("background-color","red"); //其他td为无色
$("tr").css("background-color",""); //其他td为无色
}
function changecolor(obj) {
obj.style.backgroundColor = "#A6FFFF";
s_m = $(obj).children().html(); //点击月份后获取单元格值
}
//function sent_ajax() {
$(function() {
$("#s_month").click(function() {
var s_m = $("#s_month>td").html();
//http://blog.csdn.net/denghejing/article/details/41087581 ajax方法详解
var oajax = $.ajax({
type: 'POST', //请求方式
url: 's_ajax.php',
//dataType:"json",
data:{ 'm=': s_m },//传输的参数
success: function(data){
alert( "send data:" + s_m );//返回的结果
}
});
//$('#txtHint').html(oajax.responseText);
});
});
</script>
</head>
<body>
<form>
<table>
<tr>
<!-- 显示佣金月份 -->
<td><table id="tab1" class="bordered">
<tr>
<th>月份</th>
</tr>
<tr id="s_month"><td> 201706</td> </tr>
</table></td>
<!-- 显示个人佣金清单 -->
<td><table id="tab2" class="bordered">
<tr>
<th>薪资项目</th>
<th>具体金额</th>
</tr>
<tr><td> 固定工资</td> <td><?php echo $_POST['m']; ?> </td></tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
点击了月份后,希望金额能显示相应值,但一直无法显示任何内容,不知道ajax获取的s_m值如何传给php