check if foler exists in the root jquery

Posted by Dimal Chandrasiri on Stack Overflow See other posts from Stack Overflow or by Dimal Chandrasiri
Published on 2013-06-28T03:57:36Z Indexed on 2013/06/28 4:21 UTC
Read the original article Hit count: 103

Filed under:
|

I'm trying to load an image to a div background using the following file structure in the root.

WebContent --
            |
            zharaimages --
                         |
                         [ItemID] --
                                   |
                                   Image.jpg

This is done by jQuery and the file structure is inside the root. The ItemID folder is dynamic and I have to check whether the path exists using jQuery and if the path is not valid, I should go to a default path to fetch the default image. How can I check the path is valid using jQuery. I'm hoping to this can be done without an ajax call.

Can any one help me on a tutorial or an API I can use for this!

UPDATE

The files are on the server. The concept I have is that I have 100s of item elements & I want to load an image for each item element. The images are saved in the server ( a local host ) and the folder hierarchy is divided using the item ID as shown. What I want to do is check whether the image file exists before appending it to the background of the item element div. Is this possible. This is a web application developed using spring.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery