This is my jsp that get called through ajax.
<s:iterator var="result" value="all" id="result">
<div class="Item">
<span class="item_id" style="display:none"><s:property value="%{#result.id}"/></span>
</div>
</s:iterator>
and this is my javascript that called it using jquery.
jQuery.ajax({
type:"POST",
url:"test.jsp",
data:"type="+type+"&start_id="+start_id,
success:function(data){
item_id=$(data).find(".item_id").text();
console.log("item_id="+item_id);
}
});
my problem is i want to know the last item_id that i called. so that i can called the next one. How i do that? my code get me everything in that class item_id without any separator so i don't know what's my last id.
output example:
7910 ==> i only want 10.
You can use following
item_id=$(data).find(".item_id:last").text();
instead of item_id=$(data).find(".item_id").text();