Topic: Weird syntax error?

I have a javascript file (for uploadify) that's showing 2 syntax errors. (IDE is Eclipse)
I indicated them in red. What could the problem be? I have some javascript for my text_field_tags that worked before I implemented this, and now that doesn't work anymore. So if I could fix this problem .... tongue

<%= javascript_include_tag 'swfobject.js', 'jquery.uploadify.v2.1.4.js' %>

<script type="text/javascript" charset="utf-8">
    <%- session_key = Rails.application.config.session_options[:key] -%>
    $(document).ready(function() {
   
        $('#photo_photo').click(function(event){
            event.preventDefault();
        });
   
        $('#photo_photo').uploadify({
              uploader : '/uploadify/uploadify.swf',
            cancelImg : '/uploadify/cancel.png',
            buttonImg : '/images/btn_upload.jpg',
            width : 83,
            height : 21,
            multi : true,
            auto : true,
              script : '/users/<%= current_user.id %>/albums/<%= @album.id %>/photos',
            onComplete : function(event, queueID, fileObj, response, data) {
                var dat = eval('(' + response + ')');
                $.getScript(dat.photo);},
              scriptData : {
                '_http_accept': 'application/javascript',
                'format' : 'json',
                '_method': 'post',
                '<%= session_key %>' : encodeURIComponent('<%= u cookies[session_key] %>'),
                'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>'),
                'album_id' : '<%= @album.id %>'
            }
        });
   
        $('#photo_submit').click(function(event){
            event.preventDefault();
            $('#photo_photo').uploadifyUpload();
        });
   
    });
</script>

Thanks!

Re: Weird syntax error?

Hm, just found what the problem was:

I've put this line out of the <script> tags and the syntax errors went away smile
<%- session_key = Rails.application.config.session_options[:key] -%>

But the javascript I'm using for some text_field_tags (which are loaded in the page through a partial) aren't working anymore. When I delete this line from my layout file, the javascript for the text_field_tag works again:
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jq … ery.min.js' %>

Has this got something to do with this?
http://docs.jquery.com/Using_jQuery_wit … _Libraries

//edit: Ok, problem solved ! smile (with the jQuery.noConflict())

Last edited by mattyh88 (2011-02-25 06:38:02)