iPixel Posted February 2, 2011 Share Posted February 2, 2011 So i pass 2 variables to a js function. Image Source and the Image Name. I want to use the image name to know what image i should show to the user first but i need to use the image source in order to look into a specified directory, find all the files that exist there and place all the filenames into a javascript array. function showgallery(imgsrc,img) { // Do some fancy stuff to show Large Photo here... (this part i can do) // Get Directory listed and placed into array so that i can do previous / next photo changing. --- THIS PART I NEED HELP WITH } Thanks Much! Quote Link to comment Share on other sites More sharing options...
.josh Posted February 2, 2011 Share Posted February 2, 2011 You cannot do this with javascript. You have to use server-side script to get a list of files in directory on server and output it to the client (in the form of a js array or whatever). You can do it on page load or use ajax to make a request to server-side script to get a listing and return results. Quote Link to comment Share on other sites More sharing options...
iPixel Posted February 2, 2011 Author Share Posted February 2, 2011 that makes sense, clearly im an idiot i completely forgot js is client side. Thanks! AJAX is a great alternative Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.