Jump to content


Photo

help needed returning php using ajax


  • Please log in to reply
No replies to this topic

#1 sbo1

sbo1
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 August 2006 - 03:08 AM

I have an AJAX script that returns a variable from a php script. No problem this next snippet works great. Here it is:


<?php
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; ?>
<!-- here is the XML -->
<totals> <picture><?php echo $picture; ?></picutre> // returns sun.jpg </totals>

I get sun.jpg returned. Now here is the problem I want to insert the $picture (i.e sun.jpg) variable so that the result is a hyperlink like this...




<picture> <a href="images/<?php echo $picture; ?>"></a> </picutre> //doesn't work


I try replacing the following signs  < " and > with codes:




<picture>&lta href=&quotimages/<?php echo $picture; ?>"&gt&lt/a&gt </picutre>


but again this does not work. I get nothing returned at all with the above code. I am a newbie at ajax. I have only a cursory knowledge of XML and Javascript. I am sure there is something silly I am doing here. Any clues? Thanks for any help. Steven.

(edited by a moderator to clean up the code so it wraps)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users