خرید بک لینک

Vote count: 0

I have created a new Rails 4 project and I am trying to load an exteal JavaScript file in my HTML file. I have placed the JavaScript file in the /assets/javascripts directory and included the file in my HTML file.

My HTML file:

<html>

    <body>
        <script src="/assets/hello.js"></script>
    </body>


</html>

My JavaScript file:

document.write("test");

I do not see any errors in my web browser console when loading the website. I am pretty sure I put the JavaScript file in to correct directory but the file will not run. Does Rails require something for exteal JavaScript files to work properly?

I have also tried defining a method in the JavaScript file and calling it within a <script> tag but I get a "Uncaught ReferenceError: methodname is not defined".

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 4 اسفند 1394 ساعت: 10:55

صفحه بندی