I'm having trouble getting a very simple FBJS ajax call to work on a facebook application tab. For the purposes of this example, all I want to do is click on a link and load an image into an empty div.
Code:
<script type="text/javascript">
function do_ajax() {
var ajax = new Ajax();
ajax.ondone = function(data) {
document.getElementById('ajax1').setInnerFBML(data);
}
ajax.post('myurl/ajax.php');
}
</script>
<a style="display: block;" onclick="do_ajax(); return false;"><img src="myurl/play.jpg"></a><br />
<div><span id="ajax1"></span></div>
<script type="text/javascript">
function do_ajax() {
var ajax = new Ajax();
ajax.ondone = function(data) {
document.getElementById('ajax1').setInnerFBML(data);
}
ajax.post('myurl/ajax.php');
}
</script>
<a style="display: block;" onclick="do_ajax(); return false;"><img src="myurl/play.jpg"></a><br />
<div><span id="ajax1"></span></div>
Using this code, no errors occur and nothing happens. The code on the ajax page just echos an image tag like so: Code:
<?php
echo '<img src="path to image">';
?>
Thanks for any help!