我需要從通過表單(通過電子郵件發送)以及數據在此處發送的元素標識中獲取的數據(使用jqueryui draggables/droppables/sortables)在表單提交時發送元素標識
function submitForm() {
$.ajax({type:'POST',
url: 'send_tile.php',
data:$('#tiles_collected').serialize(),
success: function(response) {
$('#tiles_collected').find('.form_result').html(response);
}});
return false;
}
用於獲取ID的功能是這樣的(不知道是否可行權尚未其一):
function getSku() {
var myIds = new array();
$("#collection li").each(function(index, element){
alert($(this).attr('id'));
myIds.push(element.id);
});
和形式如下:
<form id="tiles_collected" name='tiles_collected' method="post" onsubmit="return submitForm();">
Email:<input name='email' id='email' type='text'/><br />
Name:<input name='name' id='name' type='text' /><br />
Zip code: <input name='zip' id='zip' type='text' /><br />
<input type='hidden' id='sku' />
<input type="submit" name="submit" value="Email collection to yourself and us" /><br/>
<div class="form_result"></div>
</form>
任何人都可以給我一個幫助嗎?
而且你在哪裏使用myIds陣列 – 2012-04-09 11:06:27