Jump to content

passed string generates garbage


bloodaxe

Recommended Posts

I have modified this JavaScript snippet from another post and when I ran it in the debugger it seems to be producing garbage instead of the required string to load the images. I am trying to populate the table with a series of images named; Weymouth by steam 2012 0x.jpg, where x is a serial number for each successive phot. I have got to the idea I have not got the quotes correct, but can someone show me how to produce the correct tag so the images will load. the previous line seems to work to return the initial correct strings in the id assignment so the ids read data1, data2 etc, but then it all goes wrong.this is a bit of text from the debugger which may help!Failed to load resource: Unexpected end of file from server (18:55:26:130 | error, network) at http://localhost:8383/weymouth2/Weymouth%20by%20steam%202012%200Failed to load resource: Unexpected end of file from server (19:26:57:716 | error, network) at http://localhost:8383/weymouth2/Weymouth%20by%20steam%202012%200

Link to comment
Share on other sites

you should url encode the paths, using encodeURIComponent, if they are going to contain spaces or special charactershttp://www.w3schools.com/jsref/jsref_encodeuricomponent.asp

  • Like 1
Link to comment
Share on other sites

Thanks. I am trying to work through the idea. the photo files are called what they are called. My problem is that each is serially numbered hence the i variable which will append the corect number to each file in the middle of the URL. ie Weymouth by steam 2012 01.jpg, Weymouth by steam 2012 02.jpg and so on! The idea is to populate a table with a pic in each cell then later I will make the pics link to themselves in a new window. I can see what the idea of URIEncode is but with a variable in the middle of the uRL it gets a bit tricky.

Link to comment
Share on other sites

Thanks. I am trying to work through the idea. the photo files are called what they are called. My problem is that each is serially numbered hence the i variable which will append the corect number to each file in the middle of the URL. ie Weymouth by steam 2012 01.jpg, Weymouth by steam 2012 02.jpg and so on! The idea is to populate a table with a pic in each cell then later I will make the pics link to themselves in a new window. I can see what the idea of URIEncode is but with a variable in the middle of the URL it gets a bit tricky.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...