I'm stuck on this for 2 weeks now.. All my google search links are purple and I haven't find a solution yet :s
我现在已经坚持了两个星期..所有我的谷歌搜索链接都是紫色的,我还没有找到解决方案:s
I have a form that uploads multiple files together with 2 email addresses. All the error validations work but when I upload files I can't send my form anymore.
我有一个表单,上传多个文件和2个电子邮件地址。所有错误验证都有效,但是当我上传文件时,我不能再发送我的表单了。
JAVASCRIPT
<script>
$(document).ready(function(){
$( "#uform" ).submit(function( event ) {
var files = document.getElementsByName("files[]");
fEmail=$("#fEmail").val();
yEmail=$("#yEmail").val();
$.ajax({
type: "POST",
url: "upload.php",
data: "files[]="+files+"&yEmail="+yEmail+"&fEmail="+fEmail,
success: function(html){
for (var x = 0; x < files.length; x++) {
if(files[x].value == '' || files[x].value == '0'){
$("#uploaderror").html("No file selected!");
}
}
if (html.trim()=='fEmailError') {
$("#uploaderror").html("Please enter a valid Email address!");
}
if (html.trim()=='yEmailError') {
$("#uploaderror").html("Please enter a valid Email address!");
}
if (html.trim()=='uploadIsSuccess') {
$("#uploadsuccess").html("Success!");
}
}
});
return false;
});
});
</script>
1 个解决方案
#1
0
Try to use the success/error/complete callback options & take it from there:
尝试使用success / error / complete回调选项并从那里获取:
success: function(data) {
alert(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
#1
0
Try to use the success/error/complete callback options & take it from there:
尝试使用success / error / complete回调选项并从那里获取:
success: function(data) {
alert(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}