sbo1 Posted August 13, 2006 Share Posted August 13, 2006 [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][code]<?phpheader("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>[/code][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...[/color][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][code]<picture><a href="images/<?php echo $picture; ?>"></a> </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) Link to comment https://forums.phpfreaks.com/topic/17380-help-needed-returning-php-using-ajax/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.