0

I have a .load jquery running in a file which I am accessing from this url

http://example.com/site_folder/case-studies/firstcase

Now the file has been saved under this directory

site_folder (dir)
     assets (dir)
        case_study_content (dir)
             file.txt (file)

My code is

$( "#slider li#"+nextId ).load( "../assets/case_study_content/file.txt #pickup");

it doesn't load the file content.

Now if I keep the file under site_folder and do the load as

 $( "#slider li#"+nextId ).load( "file.txt #pickup");

it works fine.

1 Answer 1

1

When you use a relative path, it's irrelevant where you loaded the script from. The path is relative to the page that loaded the script.

If your page is inside the site_folder folder, then you use this to load the file:

$("#slider li#" + nextId).load("assets/case_study_content/file.txt #pickup");
Sign up to request clarification or add additional context in comments.

3 Comments

I tried that but didn't work.Actually I think this is happening because of seo urls.
@user3671491: Then you may need to reevaluate what the URLs are. The only thing that matters is what URLs the browsers see, not where the files actually are on the server.
Sorted out. There was a htaccess file which was stopping the file to load.Thanks a lot for your help :)

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.