SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast inderpal.singh's Avatar
    Join Date
    Jul 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image display using AJAX

    Hi,

    I am writing a small AJAX based application in which I have to display an image dynamically. I am returning the image name from PHP using XML. is there any way I can display the image instead of the image name on HTML page? Should I return just image name or the fully qualifies ANCHOR Tag?

    I would appreciate any help in this regard. Thanks in advance!!

    Best Regards,
    Inderpal Singh

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once you have the image url you can create an image tag and append it to your document in the right place.
    Code:
    var myImageURL = "/images/clowns.gif" // this really comes from ajax call
    var myImage = document.createElement("img");
    myImage.src = myImageURL;
    
    document.getElementById("someDIV").appendChild(myImage);


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •