View Full Version : parse erors in ajax link
I am trying to use the dynamic ajax content script from DD.
I would like toreference php variables to select the conten to load.
I cant reslove my parse errors in writingout the a href tag.
Can anyone help please?
?>
<a href="javascript:ajaxpage(<?php' ./$p1'?>, 'contentarea');><img src=<?php './images/{$book['pix']}'?> border='0' width='80' height='100'/></a>"
<div id="contentarea"></div>
<?php
Well, I think that you would need to echo it:
?>
<a href="javascript:ajaxpage(<?php echo' ./$p1'; ?>, 'contentarea');><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>"
<div id="contentarea"></div>
<?php
Well, I think that you would need to echo it:
?>
<a href="javascript:ajaxpage(<?php echo' ./$p1'; ?>, 'contentarea');><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>"
<div id="contentarea"></div>
<?php
Hi Nile, thanks for that.
It works in part.
This works;
<a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');">Link</a>
However, the image tag screws it up with a parse error, code below
<a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src=<?php echo './images/{$book['pix']}'; ?> border='0' width='80' height='100'/></a>
Any suggestions welcome.
Try this:
<a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src=<?php echo './images/{$book[\'pix\']}'; ?> border='0' width='80' height='100'/></a>
Thanks. Tried it and got an image box but no image. checked varaible has image reference and it does, so not finding the path i guess.
Tried a variation also (below) to no avail.
cant think of what to try next?
<a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src="<?php echo "/images/".$book['pix']; ?>" border='0' width='80' height='100'/></a>
Hi Nile. Added a . and it works.Many thanks for your help.Code below
<a href="javascript:ajaxpage('<?php echo $p1?>', 'contentarea');"><img src="<?php echo "./images/".$book['pix']; ?>" border='0' width='80' height='100'/></a>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.