Javascript stops without error message

Using compile Uploadify and 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>

This script works fine when templateID is set to a real number (without a line at the end to purposefully throw an error), but when an 42scsinvalid string is passed in , as shown in the above code, warning script

"Some error text"

What is the correct return value when an exception is thrown on the server side. Then the script just stops doing anything else when it is intended to throw a Jgrowl error. Any ideas why this is not happening?

I use Jgrowl exactly the same on another page, and it works great.

+3
source share
1 answer

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>
+3

Source: https://habr.com/ru/post/1789229/


All Articles