views:

43

answers:

1

I'm developing my first Facebook application in ASP.NET 2.0 and doing a simplest thing, i.e. to show a navigation on top with four hyperlinks where each link targets to another .aspx page. Please if someone can help me doing this using FBML in ASP.NET 2.0.

Other wise coming to my question, where i'm struck after trying above thing at my self and failed then had to go around AJAX way of doing this. Now i'm using ajax call over onclick event of each hyperlink from top navigation and its succesfully loading external .aspx pages (eg. http://apps.facebook.com/brand-is-everything/). Problem is when user comes on the application on first time, it only shows the .aspx page which has a navigation and a ajax content place holder which is programmed to be filled with contents on click event.

My question is how to load ajax contents into the ajax content place holder on page load without click event.

Any help will be appriciated a lot. In fact your help would life saving for me.

Regards.

A: 

Here an example on how to append HTML/FBML into a div after an AJAX call:

<script type="text/javascript">

  var ajax = new Ajax();
  ajax.responseType = Ajax.FBML;
  ajax.ondone = function(response) {
    document.getElementById('myDiv').setInnerFBML(response);
  }

  var postUrl = '<?php echo CALLBACK_URL ?>';
  postUrl += '/services/ajax.php?action=get_content_to_load_into_div';
  ajax.post(postUrl);

</script>

<div id="myDiv"></div>
agbb