I have many items, I want to post the specific item information after click using ajax. Usually I store its information by attribute data-name, data-date, etc. I use jquery to get it by .attr(). I do not know how to do it if the text is too long or if each item has an array of text {"Text1", "Text2","Text3"...."Text20"}. I can not store it as an attribute. I can not figure out where to put it or how & how to get by jQuery?
my Items look very simple like this
<div class="item">
<a data-name="item1" data-available="1" data-color="blue">Item1</a>
</div>
<div class="item">
<a data-name="item2" data-available="1" data-color="pink">Item2</a>
</div>
This is my jquery
jQuery(".item a").on('click', function () {
var url = "/test.php";
var item_name = jQuery(this).attr("data-name");
jQuery("#display").html("<img id='loading_gif' src='/loading.gif'>");
jQuery("#display").load(url,{item_name:item_name});
return false;
});
<input type="hidden"/>to store the value