omid_student Posted October 6, 2014 Share Posted October 6, 2014 Hi. I download image with ajax in jquery this.xhr = $.ajax({ type: "POST", url: "a.jpg", }).done(function (data) { }); but how show downloaded image in <img> tag? thanks all Link to comment Share on other sites More sharing options...
niche Posted October 6, 2014 Share Posted October 6, 2014 It doesn't seem you can do that with ajax and jquery (oddly). Here's a solution: http://stackoverflow.com/questions/4285042/can-jquery-ajax-load-image Link to comment Share on other sites More sharing options...
Ingolme Posted October 6, 2014 Share Posted October 6, 2014 Simply setting the src attribute of an <img> element will make it display. // Create the imagevar img = document.createElement("img");// Set the file nameimg.src = "a.jpg"// Add it to an elementdocument.body.appendChild(img); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now