Jump to content

passed string generates garbage


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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...