Page 1 of 1
Updating an image via Javascript
Posted: Wed Jul 22, 2015 5:29 pm
by Chris Dillow
I am trying to update an image via Javascript. The variable here "image" is a base64 string of the image. I am guessing this would be the JS to update the image but it does not work. What am I doing wrong?
Appery('mobileimage').asset(image);
Updating an image via Javascript
Posted: Wed Jul 22, 2015 6:26 pm
by Chris Dillow
Updating an image via Javascript
Posted: Wed Jul 22, 2015 6:39 pm
by james7651922
I thought it would be something like you posted or else something like this, but so far nothing has worked.
$('image[name=imagename]').asset('assets/image/yourimage');
Updating an image via Javascript
Posted: Wed Jul 22, 2015 8:15 pm
by Chris Dillow
I found my answer and because the variable I am using is an object I need to further "qualify" it if thats the right word.
Appery('mobileimage').attr("src", image.imageDataBase64);
Updating an image via Javascript
Posted: Wed Jul 22, 2015 8:59 pm
by Evgene Karachevtsev
Hello Chris,
Thank you for the update, glad it works!
Updating an image via Javascript
Posted: Wed Jul 22, 2015 10:10 pm
by james7651922
Nice work Chris. What do you think the path would be for images I uploaded to Appery?
Updating an image via Javascript
Posted: Wed Jul 22, 2015 10:58 pm
by Chris Dillow
Uploaded to what? An Appery remote DB?
Updating an image via Javascript
Posted: Wed Jul 22, 2015 11:07 pm
by james7651922
No, I just uploaded some images to use in the image component to make some custom buttons. When I was assigning the asset to the image I was thinking I would have the image swap to another image I had uploaded. However, even after using the code you provided I cannot seem to correctly input the path to that directory.