前台:
<script src="js/jquery-1.8.2.js" type="text/javascript"></script>
<script type="text/javascript">
function kk() {
$.post("bookshow_findBookAskind.action?book.bookkind="+$("#sendkind").val());
}
</script><div id="nn">
<s:iterator id="bookKinds" value="bookKinds">
<input type="button" onclick="kk()" id="sendkind" value="${bookKinds}"/>
</s:iterator>
</div>
<script src="js/jquery-1.8.2.js" type="text/javascript"></script>
<script type="text/javascript">
function kk() {
$.post("bookshow_findBookAskind.action?book.bookkind="+$("#sendkind").val());
}
</script><div id="nn">
<s:iterator id="bookKinds" value="bookKinds">
<input type="button" onclick="kk()" id="sendkind" value="${bookKinds}"/>
</s:iterator>
</div>
通过book对象的get方法接收前台数据
把这个赋给一个var, 在url后面加这个var 试试或者实施直接用from表单提交试试,看能不能取值
通过book对象的get方法接收前台数据
后面传参数 请你用$.get({
})
post 那有你这样写的
<s:iterator id="bookKinds" value="bookKinds">
<input type="button" onclick="kk()" id="sendkind" value="<s:property value='bookKinds'/>"/>
</s:iterator>
把这个value换成这个样子,然后把你往后台传参数的那个不要用对象传,而用一个参数变量传递
<script type="text/javascript">
$(document).ready(function(){
$(".sendkind").click(function(){
$.post("bookshow_findBookAskind.action?book.bookkind="+$(this).val());
});
});
</script> <div id="nn">
<s:iterator id="bookKinds" value="bookKinds">
<input type="button" class="sendkind" value="${bookKinds}" />
</s:iterator>
</div>
试试
type: "POST",
url: postUrl,
cache: false,
dataType: "html",
data: postData,
success: callback,
error: callbackError || function(){}
});然后你的ajax请求应该这样写