Link to home
Create AccountLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

asked on

javascript snytax error

Can anyone see an issue with the syntax here?
The code compiles ...just complains that the syntax is not proper.
The error seems to be at the end of this line -
 isExpanded: <%= Model.ExpandYearCategoryTree ? "true" : "false" %>
                });

Here is the script:


<script type="text/javascript">        
        <% if (Model.ShowYearCategoryTree)
        { %>
        require(['ListDocs/yearCategoryTreeViewModel'], function(viewModel) {
            viewModel.init({
                years: [ <%= String.Join(",", Model.YearCategoryTreeYears) %>],
                fileAreaSiteId: <%= Model.SiteId %>,
                subscriberId: <%= Model.UserSessionVariables.SubscriberId %>,
                isExpanded: <%= Model.ExpandYearCategoryTree ? "true" : "false" %>
                });
        });
        <% } %>
        require(['ListDocs/fileDrop'], function(fileDrop) {
            fileDrop.init({
                fileDropPanel: document.body,
                subscriberId: <%= Model.UserSessionVariables.SubscriberId %>,
                getAddFilesData: function($fileDropItem) {
                    var data = { fileAreaSiteId: <%= Model.SiteId %> };
                        
                    if($fileDropItem.hasClass("jqgrow")) {
                        data.documentId = $fileDropItem[0].id;
                    }

                    return data;
                }
            });             
        });               
    </script>    

Open in new window

SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Robb Hill

ASKER

no its a boolean
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I dont know..its strange...if I end it with a comma the error goes away..but am not sure how thats effecting the code..as that does not seem like proper syntax
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
thanks
You're welcome. Glad to help. Thanks for the points.