Andrzej Gis
Andrzej Gis

Reputation: 14306

Sinatra can't see files

This line

<script type="text/JavaScript" src="public/js/jquery.js"></script>

throws an arror

GET http://localhost/ajax/public/js/jquery.js 404 (Not Found)

without 'public' it was the same.

It worked without public after i changed this in my app:

get '/' do
    erb :main

end

to:

get '/sth_else' do
    erb :main

end

But I want to load a page just with www.page.com/ with no further arguments. Please help me out.

Upvotes: 0

Views: 523

Answers (1)

Slartibartfast
Slartibartfast

Reputation: 8805

What does ajax do in your path? If you Javascript files are in public/js/jquery.js. You should be able to fetch them with

http://localhost:port/js/jquery.js

and to be able to include them with /js/jquery.js (mind the start /)

Upvotes: 5

Related Questions