0
我使用jQuery Form插件將圖像上傳到我的服務器。在上傳服務器發送信息,說明上傳是否成功,我想根據收到的數據收到這些數據顯示一條消息,但我做得不對。由於我沒有在他們的官方網頁上找到合適的信息,所以我在這裏問。這是我如何提交圖片:jQuery Form插件,如何從php接收數據
<script src="http://malsup.github.com/jquery.form.js"></script>
.
.
.
<form action="upload.php" method="post" enctype="multipart/form-data" id="uploadForm">
<label id="uploadLabel">Add new background</label><br>
<input type="file" name="file" id="file" accept="image/*"><br>
<input type="submit" name="submit" value="Upload" id="uploadButton">
</form>
---------------------------------------------------------------------------------------
$("#uploadButton").click(function(){
$('#uploadForm').ajaxForm({url: 'upload.php', type: 'post'}, function(data){
console.log(data);
});
});
然後我處理圖像中upload.php的,然後我應該從這個腳本獲得了一些數據,但我沒有收到任何東西。