0
我想在我的數據表與Jquery.For此編輯照片,POST操作使用jQuery
<a href="ajax/edit_photo.php?id=<?=$row['ID']?>" class="edit ajax" id="">-->'Edit Photo Link'
edit_photo.php:
<div class="photoEdit">
<form id="editphoto" action="1.php?id=<?=$_GET['id']?>" method="post" class="stdform quickform" enctype="multipart/form-data">
//My Forms...
</form>
</div>
我的Jquery:
jQuery('#editphoto').submit(function(){
var formdata = jQuery(this).serialize();
var url = jQuery(this).attr('action');
jQuery.post(url, formdata, function(data){
jQuery('.notifyMessage').addClass('notifySuccess');
//otherwise
//jQuery('.notifyMessage').addClass('notifyError');
jQuery.fn.colorbox.resize();
});
return false;
});
和我的1.PHP
<?
include("../../connection.php");
include("../../functions/upload.php");
?>
<?
$limit="1048576";
if(isset($_GET['kaydet'])){
$id=$_GET['id'];
$icerik=$_POST['icerik'];
$picture=DoUpload("picture",$limit,$FileUploadPath);
$result=mysql_query("SELECT * FROM tbl_photo WHERE ID=$id");
$picture2=mysql_result($result,0,"picture");
if($picture=='')
$picture=$picture2;
if($picture!="")
{
mysql_query("UPDATE `tbl_photo` SET `picture` = '$picture',`icerik` = '$icerik' WHERE `ID` =$id");
}
}
?>
我在運行編碼something.But,jQuery也沒有work.So,沒有任何東西。
你用' – Tschallacka