0

How to use variable MEDIA_URL in my my.js?

<script>
    $(function(){
        var MEDIA_URL = '{{ MEDIA_URL }}'
    })
</script>    
<script type="text/javascript" src="{{ MEDIA_URL }}/my.js"></script>

1 Answer 1

2

There is no need to define MEDIA_URL in the document ready call just do:

<script>
var MEDIA_URL = '{{ MEDIA_URL }}'
</script>    
<script type="text/javascript" src="{{ MEDIA_URL }}/my.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.