简体   繁体   中英

Cannot get image url (stored as a file) to to display on html page

Using Parse.com and JavaScript SDK

I've created a fiddle here http://jsfiddle.net/Dano007/jst34fe4/1/

The query runs and returns the current user object, as per the below screen shot part of that object is the url, which I want to display as an image. Currentlyno image is showing. I'm not sure why?

Please not the image is stored as a file in parse. I've read the parse document here, but that has'nt helped solve this. https://www.parse.com/docs/js_guide#files-retrieving

ProfilePic: {__type:File, name:tfss-fc2a6901-40a1-49d9-9044-3d4bcc42d7a1-danimage.jpg,…}
__type: "File"
name: "tfss-fc2a6901-40a1-49d9-9044-3d4bcc42d7a1-danimage.jpg"
**url: "http://files.parsetfss.com/0fc5cba8-caf7-4c81-aafc-36390888e497/tfss-fc2a6901-40a1-49d9-9044-3d4bcc42d7a1-danimage.jpg"**

在此处输入图片说明

对象结构

You should get the URL as the following: object.get('ProfilePic').url() , because the url is a method, returning the _url field.

Also, you should delete <div id="Image01"></div> , as it casues an id collision. After these it works as expected.

Edit

I have updated the fiddle link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM