我有一個名爲itemID的自定義屬性 - 我如何獲得它的值,所以我可以把它放在類似於我如何獲得id的URL中?從jquery事件獲取自定義數據
JS:
<script type="text/javascript">
$(document).ready(function(){
$('.eventImage').click(function(e){
$this = $(this);
$.ajax({
url: "http://server.local/action.php?event="+$this.attr("id")+"&itemID="+$this.data('itemID'),
type:'POST',
});
});
});
</script>
HTML:
<img class='eventImage' id='ITEM_3_ON' src='images/livingroom/1-2.png' data-itemID='3'/>
'電子!= event'在所有瀏覽器時,有沒有孩子這IMGE不能有 – charlietfl