ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

EE effecting JavaScript tags.

March 02, 2011 8:57am

Subscribe [3]
  • #1 / Mar 02, 2011 8:57am

    Kevin Gerich

    213 posts

    I have this block of javascript in a file.

    [removed]
      var options, a;
        jQuery(function(){
          options = { serviceUrl:'{site_url}directory/suggest_names' };
          a = $('#query').autocomplete(options);
        });
    [removed]

    It renders just fine in v1.7
    When I move it to v2.1.3 it renders:

    [removed]
      var options, a;
        jQuery(function(){
          options = ;
          a = $('#query').autocomplete(options);
        });

    Specifically note the “options = ” line.
    I also tried hard coding the site_url.  For some reason EE is not rendering whats between the {} . Is there some way to escape the {}?  Weird that it doesn’t effect the other parts between {}.

    Any ideas?

    Thanks,

    Jim

    fyi I tried setting $config[‘protect_javascript’] = “y”;

  • #2 / Mar 02, 2011 9:04am

    Mark Bowen

    12637 posts

    Hi James,

    Try adding the protect_javascript hidden configuration variable to your installation and see if that helps.

    Hope that works and helps a bit.

    Best wishes,

    Mark

  • #3 / Mar 02, 2011 9:09am

    Design by Front

    106 posts

    Hey Jim,

    If you have no luck with Mark’s method, can you check the following configuration?

    Go to Admin > System Administration > Output and Debugging Preferences

    If the “Debug Preference” is set to “0”, change it to “1”. I believe this should fix your issue.

    Hope this helps,
    Chuck

    (P.S some further reading on this particular issue on this comment by Derek Jones)

  • #4 / Mar 02, 2011 9:44am

    Kevin Gerich

    213 posts

    Thank You!!

    It was the output and debugging pref. (now set to one)

    I had already added the protect_javascript setting.

    Regards,

    Jim

  • #5 / Mar 02, 2011 9:53am

    Mark Bowen

    12637 posts

    Sorry didn’t see the fyi at the end of your original post. Must have totally overlooked that. Glad DBF got you up and running though.

    Best wishes,

    Mark

  • #6 / Mar 02, 2011 3:31pm

    Ingmar

    29245 posts

    Glad to see that helped. Please post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases