Ajax实现页面局部刷新
发布时间:2020-12-16 01:29:13 所属栏目:百科 来源:网络整理
导读:直接看代码吧!!!!!!!!! 页面中的js代码 //ajax局部加载页面 function sortInfo(id,type){ $.get('${base}/artGallery/artGalleryInfo.jhtml',{'id':id,'type':type},function(data){ //得到data中form中的html// var dd= $(data).find('form').html();//得到
直接看代码吧!!!!!!!!! 页面中的js代码 //ajax局部加载页面 function sortInfo(id,type){ $.get('${base}/artGallery/artGalleryInfo.jhtml',{'id':id,'type':type},function(data){ //得到data中form中的html // var dd= $(data).find('form').html(); //得到data中的form var dd= $(data).find('form'); //console.info(dd); $("#productForm").html(dd); }); }页面中有一个form表达来接受传入的数据。 <form id="productForm" action="artGalleryInfo.jhtml" method="get"> <input type="hidden" id="id" name="id" value="${member.id}" /> <input type="hidden" id="pageNumber" name="pageNumber" value="${page.pageNumber}" /> <input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize}" /> <input type="hidden" id="type" name="type" value="${type}" /> [#list page.content as product] [#if product_index % 2 == 0 && product_index % 9 != 8] <div class="clo"> [/#if] [#if product_index % 9 == 8] <div class="clo last"> [/#if] <div class="opus" onclick="window.location.href='${base}/product/detail.jhtml?id=${product.id}'"> <div class="operation"> <span class="show"></span> <span class="like"></span> <span class="shar"></span> </div> <div class="img"> <img src="${product.image}"> </div> <div class="p-content"> <p>《${product.name}》</p> <p>${product.author}<font>¥${product.price}</font></p> </div> </div> [#if product_index % 2 != 0] </div> [/#if] [/#list] </form>后台代码就不了,后台接受了两个参数。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容