|
Wednesday, 24 March 2010 10:18 |
After following the instructions on how to extract an article's body, you should have a URL that shows only the content of your article.
Use the Mootools code below to update the contents of an HTML element with your article:
window.addEvent('domready', function(){
article = 'index.php?option=com_content&view=article&id=1&tmpl=component';
var a = new Ajax( article, {
method: 'get',
update: $('id_of_element')
}).request();
}
Notes
- Place the Javascript code using the heredoc syntax to include it in Joomla! you can find more info this at the Joomla! documentation site
- Be sure to use the exact syntax when referring to the ID of an element and not use the pound sign (#).
i.e. don't use $('#id_of_element'), $(#id_of_element) or $$('id_of_element'). Valid syntax is $('id_of_element') and $$('#id_of_element'). I prefer the first option. The second syntax (with two dollar signs) may refer to multiple IDs and/or HTML tags, while the first one is limited to only one element ID (not HTML tags).
|