I have a short script that posts a serialized list. It’s working in firefox, but not chrome or explorer, which are both passing an empty post:
$_POST['list'] == ''
Here’s the code below.
<script>
$(function() {
$( "#sortable" ).sortable({
update: function(event, ui){
var postdata = $(this).sortable('serialize');
console.log(postdata);
$.post('packages.php', {list: postdata}, function(o) {
console.log(o);
}, 'json');
}
});
});
</script>
header and body content
<a href='somelink here'>
<div id='item_1'>
content....
</div>
</a>
<a href='somelink here'>
<div id='item_2'>
content....
</div>
</a>
<a href='somelink here'>
<div id='item_3'>
content....
</div>
</a>
html valid end of page
Can anyone tell me what I’m doing wrong? Thanks in advance.
The problem is most likely related to wrapping a link around your div. That’s invalid html, and could cause different results in different browsers. While still invalid, it will probably work if you put the id on the link. If not, you might have to find a different way to make your div linkable.
In short, change:
to