以下是从文件输入类型更改的脚本请看一下。请分享我如何显示回复。
$('#files').change(function(){
var url = $(this).val();
var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
var ajaximgupload="1";
if (ext == "gif" || ext == "png" || ext == "jpeg" || ext == "jpg")
{
$("#myForm").ajaxSubmit({
url: '<?php echo Router::url(array('controller'=>'floats','action'=>'index'))?>',
data: ({attachement:url}),
dataType: "text/html",
cache: false,
type: "post",
success: function(response) {
alert(response);
$("#target").attr("src","/uploads/attachement/"+response);
},
resetForm: true
});
} else { alert("Invalid Image Format"); return false;}
});