表单不是使用 ajax.form 提交点击 li 提交。给我一些解决方案
我的js代码在这里
$(document).ready(function(){
$('#sortable li').click(function() {
$("#frmgallery").submit(function(event) {
event.preventDefault();
var formdata = $(this).serialize();
alert(formdata);
$.ajax({
type: "POST",
url: "gallery.php",
data: formdata,
success: function(){alert('success');}
});
});
});
HTML 在这里
<form method="post" enctype="multipart/form-data" id="frmgallery" name="gallery" action="<?php get_template_directory();?>admin.php?page=gallery/gallery.php">
<ul id="sortable">
Query
<li class="ui-state-default" name='liindex' id="<?php echo $row['glryRecordId'];?>" >
<span style="display:none"><?php echo $row['glryRecordId'];?></span>
<img class='thumbnail' alt='' src='<?php echo get_site_url();?>/wp-content/themes/townsley/upload/<?php echo $row['glryName']; ?>' width='80' height='60'
style="border: 1px solid #D3D3D3;padding:2px;"/><input type="hidden" value="<?php echo $row['glryRecordId'];?>" name="recordId[]" />
<a href="<?php get_template_directory();?>admin.php?page=gallery/gallery.php&delid=<?php echo $row['glryRecordId'];?>" style="display:block;text-align:center" title="DELETE this image from the record" class="arial-red">Remove</a>
</li>
</ul>
</form>
请帮助我谢谢
ajax jquery javascript