I want my application to retrieve an image from the database (or file system). Eith开发者_JS百科er way how can the div anchor tag handle an image? see the example link under Remove link with JSON Result here: struts2-jquery-plugin
I have a struts2 action with JSON result type. Can I return an image with it? How do I handle it on the JQuery side? to actually display it?
Or do I want to create some temporary image on a location on the server and then feed the JSON with it's link?
Thanks a lot!
No, you can't return the image itself in the JSON response.
If the image is not already on the file system in a directory that is accessible through your web server, then you will need an action to serve the image.
Then, in your Ajax response, you will need to return the URL to the image (or the action that serves the image) along with the other data in your JSON response.
ajax only get or send strings to/from Server ...
image or any file is binary...then you cant send
精彩评论