I need to use the YUI equivalent for the jQuery .load() function in order to load external HTML template. jQuery code I'm using right now is -
$('#templates').load('file1.html');
How can I achieve the same output using YUI?
Finally devised a solution for loading the HTML. I have handled the cases for IE and NON-IE browsers. Goes like this -
function fName() {
if(navigator.appName == "Microsoft Internet Explorer") {
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open( "GET", "templates.html", true );
xmlHttp.onreadystatechange = function() {
if( xmlHttp.readyState == 4 && ( xmlHttp.status == 0 || xmlHttp.status == 200 ) )
{
document.getElementById( "div_id_here" ).innerHTML = '"' + xmlHttp.responseText + '"';
}
};
xmlHttp.send();
}
else {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "templates.html", true);
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 && (xmlHttp.status == 0 || xmlHttp.status == 200))
{
document.getElementById("div_id_here").innerHTML = xmlHttp.responseText;
}
};
xmlHttp.send();
}
}