<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>系统在线注册</title>
<script src="Scripts/jquery-1.8.2.min.js"></script>
</head>
<body> <div id="youhuaDivTmp" style="display: none">
<table name="youhuaDivTb">
<tr>
<td>
<input type="text" id="txtNewValue" /></td>
</tr>
<tr>
<td>
<input type="button" name="btnUpdate" value="确认更新" />
<input type="button" name="myclose" id="myclose" value="关闭DIV" />
<input name="gfind1" id="gfind1" type="button" class="button7" value="开始查询" >
<button name="myte" id="myte">测试中</button></td>
</td>
</tr>
</table>
</div>
<table id="testTable">
<tr>
<td>aaaa</td>
<td>
<button class="btn btnGreen_c">立即优化</button></td>
<td>
<button class="mytest">测试中</button></td>
</td>
</tr>
<tr>
<td>bbbb</td>
<td>
<button class="btn btnGreen_c">立即优化</button></td>
<td>
<button class="mytest" >测试中</button></td>
</td>
</tr>
<tr>
<td>cccc</td>
<td>
<button class="btn btnGreen_c">立即优化</button></td>
<td>
<button class="mytest">测试中</button></td>
</td>
</tr>
</table>
<script>
$(function () {
var ret="";
$(".mytest").click(function() {
// 验证代码
alert("未隐的DIV中可以使用本方法");
});
$("button[name='myte']").live("click", function () {
alert("在隐藏的DIV层中只能使用本方法");
})
$("input[name='gfind1']").live("click", function () {
alert("为什么只能用这一句才行");
})
$("input[name='myclose']").live("click", function () {
alert("请输入正确的数字,不要乱输噢");
$("#testTable").find("table[name='youhuaDivTb']").parents("tr").remove();
});
$(".btnGreen_c").click(function () {
$("#testTable").find("table[name='youhuaDivTb']").parents("tr").remove();
var template = $("#youhuaDivTmp").html();
$("<tr><td>" + template + "</td></tr>").insertAfter($(this).parents("tr"));
});
$("input[name='btnUpdate']").live("click", function () {
var newValue = $(this).parents("tr").prev("tr").find("td input").val(); var index = $("#testTable").find("table[name='youhuaDivTb']").parents("tr").index();
$("#testTable tr:eq(" + parseInt(index - 1) + ")").find("td:nth-child(1)").text(newValue);////////////////////////////////////////////////////////以下的AJAX 为什么不执行呢
alert("in");
$.ajax({
type: "POST",
cache:false,
url: "http://www.baidu.com",
dataType: 'text',
timeout: 0,
data: dataString,
error: function (xmlHttpRequest, error) {
alert( error+'=ddd'); },
success: function(data) {
//$('#findlist').html(data);
ret="do ok";
alert("go out");
}
})
alert(ret);///////////////////////////////////////////////////
});
})
</script>
</body>
</html>上面最后几行代码中的 点击按钮时,为什么不执行AJAX操作呢,有哪位帮忙修改一下谢谢,
ILOVE_ASPNET 有空能再帮我修改一下吗?Ajax函数
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货