$(document).ready(function () {
$('#upload_photo').click(function () {
$('input[type=file]#upload_myphoto').click();
});
});
$(document).ready(function () {
$("input[type=file]#upload_myphoto").change(function () {
$("#node_profilepic").prop('src', 'loader.gif');
$("#upload_profilepic").submit();
});
});
$(function () {
$('#upload_profilepic').ajaxForm({
beforeSubmit: ShowRequest,
success: function (responseText, statusText) {
alert(responseText);
//$("#node_profilepic").prop('src',responseText);
$('.iframe').click();
},
error: AjaxError
});
});
function ShowRequest(formData, jqForm, options) {
//alert(formData);
var queryString = $.param(formData);
// alert(queryString);
return true;
}
function AjaxError() {}
此代码用于使用Ajax调用上传图像,它可以在除IE之外的所有浏览器上运行。请告诉我,我可以使用IE
调用Ajax表单答案 0 :(得分:0)
尝试将setTimeout()
用于IE
,
$(function(){
$('input[type=file]#upload_myphoto').change(function () {
setTimeout(function(){
$("#node_profilepic").prop('src', 'loader.gif');
$("#upload_profilepic").submit();
},100);// you can try 0 in place of 100
});
});
阅读Inconsistent change event in IE和Jquery: change event to input file on IE