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: , , , , .

1 Comment Add your own

  • 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.

Leave a Comment

Required

Required, hidden

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


Pages

Quote of the Day

"A Dream is not something you see in your dreams, but Dream is something which will not let you sleep"

Top Posts

Recent Posts

Recent Comments

Sanjeev on Introducing iWinkr Studio
braynx on Contact Me
swiss on Advanced Word Count for P…
derek on Tutorial: How to store UTF8 (i…
Anurag Litoriya on Tutorial: How to store UTF8 (i…
Juan Felipe on Simple Ajax with YUI!!!
hiteshsathawane on Contact Me
hiteshsathawane on Tutorial: How to store UTF8 (i…

Take Some Feeds

Powered by FeedBurner

Some More Feeds

Categories

Top Clicks

Lyrics Of The Week

From the top to the bottom Bottom to top I stop At the core I've forgotten In the middle of my thoughts Taken far from my safety The picture is there The memory won't escape me But why should I care..... Forgotten, Linkin Park

Archives

My Tag Cloud

AJAX Autobiography BarCamp Blogging CSS Designing Education Entrepreneurs FOSS Stuff Fun General How-To's India 2.0 Indictrans Team Inspirational Javascript Localization MySQL News OpenIndx Personal PHP Script.aculo.us Social Techie Tutorial UI Uncategorized Unconferences Web 2.0

Calendar

November 2007
M T W T F S S
« Oct   Dec »
 1234
567891011
12131415161718
19202122232425
2627282930  

Blog Stats

Categories

Spam Blocked

FeedBurner

Enter your email address:

Delivered by FeedBurner

Digg This

Links