Page 1 of 1

Populating an image url from a REST service, Appery overwriting image source url

Posted: Mon Apr 21, 2014 9:01 pm
by Crystal Ege

I am having trouble appending a url to an image file name. I have a REST service mapped to the image component and have added the following javascript.

$(element).attr( "src", "http://166.78.237.229/CatalogFiles/" + value);

The image source is updated but Appery is overwriting it after the image loads.

Here is the header information:
Remote Address:166.78.237.229:80
Request URL:http://166.78.237.229/CatalogFiles/on...
Request Method:GET
Status Code:200 OK (from cache)

Remote Address:107.22.249.220:80
Request URL:http://appery.io/app/view/76bda11c-af...
Request Method:GET
Status Code:302 Moved Temporarily

Any idea on how stop Appery from overwriting the image source?


Populating an image url from a REST service, Appery overwriting image source url

Posted: Tue Apr 22, 2014 2:54 am
by Illya Stepanov

Hi Crystal -

What you're trying to achieve as a result?


Populating an image url from a REST service, Appery overwriting image source url

Posted: Tue Apr 22, 2014 12:41 pm
by Crystal Ege

Currently, the image control url is only the image. For example "image.jpg"
I am trying to append the source url of the images with http://166.78.237.229/CatalogFiles/im....

I have a clickable list control that is populating from a REST service. The list control displays "categories" and associated images for the category.

Through debugging, I discovered that the Javascript is appending the url but Appery is overwriting the image url when looping through the list control continue populating the "categories".


Populating an image url from a REST service, Appery overwriting image source url

Posted: Tue Apr 22, 2014 8:02 pm
by Kateryna Grynko

Hi Crystal,

Remove Image component mapping and Image URL won't be changed.


Populating an image url from a REST service, Appery overwriting image source url

Posted: Wed Apr 23, 2014 2:08 pm
by Crystal Ege

I cannot remove the image component mapping. It dynamically sets the image src name.

I need to append the image src to display the full path to the image src not just the file name because the image files are not located within appery.

Appery was replacing the url with each loop.

I added javascript to update all the image urls if the service is successful.

function ListViewImgShow(){
$("img.ListViewImg").each(function (index, element){
/* alert($("img.ListViewImg").eq(index).attr("src"));*/
$(".ListViewImg").eq(index).attr("src", "http://url.com/CatalogFiles/" + $("img.ListViewImg").eq(index).attr("src") );
});

This is working. Thank you for your assistance


Populating an image url from a REST service, Appery overwriting image source url

Posted: Wed Apr 23, 2014 2:20 pm
by Kateryna Grynko

Thank you for the update. Let us know if you need any further help.