Simple Ajax with YUI!!!
November 26, 2007
For those of you, who want to get started with YUI and Ajax, this would surely prove helpful.
<html><head>
<title>Lets learn YUI</title>
</head>
<body>
<div id="mydiv">
Add some Text or Images if you want to replace dynamically</p>
</div>
<p><a href="Loading.html" onclick="return YUI();">My first AJAX</a></p>
<script src="build/yahoo/yahoo-min.js" type="text/javascript"></script>
<script src="build/event/event-min.js" type="text/javascript"></script>
<script src="build/connection/connection-min.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function YUI(){
var loadUrl = "Loading.html";
var callback = {
success: function(o) {
document.getElementById('mydiv').innerHTML = o.responseText;
},
failure: function(o) {
alert("AJAX doesn't work"); //FAILURE
}
}
var transaction = YAHOO.util.Connect.asyncRequest('GET', loadUrl, callback, null);
return false;
}
//]]>
</script>
</body>
</html>
This is how one can simply make AJAX calls using YUI. The code is simple and self explanatory. If you need any help with this, please drop in comments.
Cheerz
Shri
Entry Filed under: AJAX, UI, Yahoo. Tags: AJAX, begineers, Code, simple, yui.
1 Comment Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed

1.
Juan Felipe | August 29, 2008 at 2:38 pm
Hola estoy realizando mi sitio con las librerias de yahoo YUI, pero no logro enviar parĂ¡metros usando AJAX o JSON, podrĂan darme la solucion?, gracias.