Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery.form.js插件文件上传成功回调函数不';我不在IE工作_Jquery_Ajax_Internet Explorer_Callback_Jquery Forms Plugin - Fatal编程技术网

jquery.form.js插件文件上传成功回调函数不';我不在IE工作

jquery.form.js插件文件上传成功回调函数不';我不在IE工作,jquery,ajax,internet-explorer,callback,jquery-forms-plugin,Jquery,Ajax,Internet Explorer,Callback,Jquery Forms Plugin,jquery.form.js插件fileupload成功回调函数在IE中不起作用 fileupload成功回调在chrome、firefox和safari中工作 我不知道为什么“成功回调函数”在IE中不起作用(IE9、IE8、IE7也是…) 这是我的代码 函数func_beforesmit(){ } 函数函数成功(数据){ 警报(数据); } 函数功能完成(xhr){ 警报(xhr.responseText); } jQuery(文档).ready(函数(){ 变量选项={ clearForm

jquery.form.js插件fileupload成功回调函数在IE中不起作用

fileupload成功回调在chrome、firefox和safari中工作

我不知道为什么“成功回调函数”在IE中不起作用(IE9、IE8、IE7也是…)

这是我的代码


函数func_beforesmit(){
}
函数函数成功(数据){
警报(数据);
}
函数功能完成(xhr){
警报(xhr.responseText);
}
jQuery(文档).ready(函数(){
变量选项={
clearForm:true,//成功提交后清除所有表单字段
resetForm:true,//成功提交后重置表单
url:“url请参见,它处理类似的问题

您正在使用AJAX上传一个文件,这可能会导致IE出现问题。请参阅,这几乎肯定会解决您的问题

简言之,您需要确定浏览器是否正在使用XMLHttpRequest对象,如果不是,请在中返回结果,并将内容类型设置为text/html,以防止IE显示打开/保存对话框

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>

    <script type="text/javascript">
        function func_beforeSubmit() {
        }
        function func_success(data) {
            alert(data);
        }
        function func_complete(xhr) {
            alert(xhr.responseText);
        }

        jQuery(document).ready(function() {
            var options = {
                clearForm       :   true,        // clear all form fields after successful submit         
                resetForm       :   true,        // reset the form after successful submit
                url             :   "url <-- just return text string",
                type            :   'post',
                dataType        :   'text',
                beforeSubmit    :   func_beforeSubmit,
                success         :   func_success,
                complete        :   func_complete
            };

            jQuery('#btn_file_upload_ajax').change(function() { jQuery('#frm_upload_ajax').submit(); });
            jQuery('#frm_upload_ajax').ajaxForm(options);
        });

    </script>
</head>
<body>
    <form id="frm_upload_ajax" method="post" enctype="multipart/form-data">
        <input type="file" name="attach_imgfile_ajax" id="btn_file_upload_ajax" ><br>
        <input type="hidden" id="data" name="data"/>
    </form>
    <hr><br>
            <div id="image_upload_preview"></div>
</body>