views:

47

answers:

1

I have one url , which returns an image tag.Now i need to call this url using javascript , and embed this return under a div tag. I was trying $.get(), but "data" is returning some text.How to retrieve the image in javascript. note: pls provide sln with javascript/jquery.

Edit: data returns GIF40 or soem this kind of arbitary value..

A: 

try

$.ajax({
   method: 'get',
   url: 'image.php',
   success: function(data){
      $('#divId').append($(data).find('img')); 
  }

})
Reigel
i tried $.get('myurl', function(data) { //$('.result').html(data); $('#myid').append($(data).find('IMG'));; ..but it didnt work
Wondering
but if you won't do `.find()`, did it work?
Reigel
its returning image name..not image.
Wondering
ahh, I'm guessing it's the path of the src of the img tag thats causing you the problem.... maybe because it's not pointing to a full path...
Reigel
its a full path..id i paste myurl in browser, it retruns an image
Wondering
can you please put in your question above the output of `'myurl'` in your `$.get()`
Reigel
i have updated my post
Wondering