Jump to content

help needed returning php using ajax


sbo1

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]


[code]<?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>
[/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>&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)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.