I need to take the data I get from an element id pulled from dropped items (using jqueryui draggables/droppables/sortables) to be sent via a form (to be emailed) along with data here:
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;
}
the function for getting the ids is this (not sure if it works right yet either):
function getSku() {
var myIds = new array();
$("#collection li").each(function(index, element){
alert($(this).attr('id'));
myIds.push(element.id);
});
and the form looks like this:
<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>
Can anyone give me an assist?
To just add the ID’s to the data sent to the server you can use extend or just add them in the Ajax function.
extend:
or just add them directly: