这是标签,我想将所有需要的值都放入警报框中。如何在标签中重新分配它们?
$('.searchbutton').click(function() {
$.get('productsearchjson2', {
searchtext: $('#gettext').val()
}, function(responsetext) {
if (responsetext !== null) {
$('.block2').find("remove").remove();
$.each(responsetext, function(key, value) {
var newlist = $('<remove><img></img><op></op><a2></a2><a3></a3></remove>');
newlist.children().eq(0).text(value['imagename']);
newlist.children().eq(1).text(value['id']);
newlist.children().eq(2).text(value['productname']);
newlist.children().eq(3).text(value['price']);
newlist.appendTo(value2);
});
var value2 = $('#getit');
alert(responsetext);
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="block2" id="getit">
<remove>
<div class="block2-img wrap-pic-w of-hidden pos-relative block2-labelnew">
<img scope="col" src="subimages/${lop.imagename}" alt="IMG-PRODUCT">
<div class="block2-overlay trans-0-4">
<a href="#" class="block2-btn-addwishlist hov-pointer trans-0-4">
<i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i>
</a>
<div class="block2-btn-addcart w-size1 trans-0-4">
<!-- Button -->
<button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4">
Get It
</button>
</div>
</div>
</div>
<div class="block2-txt p-t-20">
<po scope="col" class="block2-sid">${lop.sid}</po>
<a href="#" class="block2-name dis-block s-text3 p-b-5">
${lop.name}<a2 scope="col"></a2>
</a>
<span class="block2-price m-text6 p-r-5">
${lop.price}<a3 scope="col"></a3>
</span>
</div>
</remove>
</div>
这是使用json的Javascript,如何将它们添加到相应的位置,这是正确的方法,请让我知道谢谢**