Jump to content


This topic is now archived and is closed to further replies.


help needed returning php using ajax

Recommended Posts

[color=blue]I have an AJAX script that returns a variable from a php script. No problem this next snippet works great. Here it is:[/color]

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>

[color=blue]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...

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

[color=blue]I try replacing the following signs  < " and > with codes:[/color]

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

[color=blue]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.[/color]

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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.