Chris Dillow
Posts: 0
Joined: Fri Nov 21, 2014 12:39 am

Updating an image via Javascript

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);

Chris Dillow
Posts: 0
Joined: Fri Nov 21, 2014 12:39 am

Updating an image via Javascript

Any ideas?

james7651922
Posts: 0
Joined: Tue Jul 21, 2015 2:53 am

Updating an image via Javascript

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');

Chris Dillow
Posts: 0
Joined: Fri Nov 21, 2014 12:39 am

Updating an image via Javascript

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);

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Updating an image via Javascript

Hello Chris,

Thank you for the update, glad it works!

james7651922
Posts: 0
Joined: Tue Jul 21, 2015 2:53 am

Updating an image via Javascript

Nice work Chris. What do you think the path would be for images I uploaded to Appery?

Chris Dillow
Posts: 0
Joined: Fri Nov 21, 2014 12:39 am

Updating an image via Javascript

Uploaded to what? An Appery remote DB?

james7651922
Posts: 0
Joined: Tue Jul 21, 2015 2:53 am

Updating an image via Javascript

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.

Return to “Issues”