繁体   English   中英

Javascript停止运行,没有错误消息

[英]Javascript stops running with no error message

使用Uploadify和JGrowl组合:

<link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/jgrowl.css" />
<script type="text/javascript" src="js/jquery1.4.4.js"></script>
<script type="text/javascript" src="js/jgrowl.js"></script>
<link rel="stylesheet" type="text/css" href="css/artworkDesigner.css" />  
<link href="js/uploadify-2.1.4/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/uploadify-2.1.4/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/uploadify-2.1.4/swfobject.js"></script>
<script type="text/javascript" src="js/uploadify-2.1.4/jquery.uploadify.v2.1.4.min.js">/script>

<script type="text/javascript">    
    // <![CDATA[    
    var uploadType = "art";    
    var templateID = "42scs";

    $(document).ready(function() {

        $('#fileInput').uploadify({

            'uploader': 'js/uploadify-2.1.4/uploadify.swf',    
            'script': 'js/uploadify-2.1.4/UploadHandler.ashx',    
            'cancelImg': 'js/uploadify-2.1.4/cancel.png',    
            'scriptData': { 'type': uploadType, 'templateID': templateID },    
            'auto': true,    
            'multi': true,    
            'fileDesc': 'Image Files',    
            'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',    
            'queueSizeLimit': 90,    
            'sizeLimit': 4000000,    
            'buttonText': 'Choose Images',    
            'folder': '/uploads/test',    
            'onComplete': function(event, ID, fileObj, response, data) {

                if (response != "1") {

                    alert(response);   // ALERTS 'ERROR TEXT' which is expected

                    // DOESNT RUN THIS LINE:, AND REST OF SCRIPT SEEMS TO FREEZE 
                    $.jGrowl("<strong>Error!</strong><br />" + response, { sticky: true });
                    alert("flag"); // THIS IS NOT RUNNING

                } else {

                    alert(fileObj.name + "\n" + fileObj.filePath + "\n" + ID + "\n");
                    alert(response);

                }

            }

        });

    });

    // ]]></script>

这个脚本工作正常,当templateID设置为实数(最后没有字符串故意抛出错误),但是当在42scs传递无效字符串时,如上面的代码所示,脚本警报

“一些错误文字”

当服务器端抛出异常时,哪个是正确的返回值。 然后脚本停止做其他任何事情,当它意味着抛出Jgrowl错误。 任何想法为什么不发生这种情况?

我在另一个页面上使用Jgrowl完全相同,它工作正常。

对Jquery库的双重引用将发生冲突:

<script type="text/javascript" src="js/jquery1.4.4.js"></script>
<script type="text/javascript" src="js/uploadify-2.1.4/jquery-1.4.2.min.js"></script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM