Simple Ajax with YUI!!!
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</div> <a href="Loading.html" onclick="return YUI();">My first AJAX</a> <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
If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.
The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.
CHECK out and BUY the PHP and Script.aculo.us book at Packt official site
http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book
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.
hiii i wanna learn YUI i konw c,c++ and java !! can i learn YUI or i have to learn some other languages also !!
no, yui isnt for people who are undecided.
hiii i wanna learn YUI i konw c,c++ and java !! can i learn YUI or i have to learn some other languages also !!!! reply ASAP
hiii i wanna learn MTV i konw hbo,espn and fox !! can i learn MTV or i have to learn some other channels also !!!! reply ASAP
you hava to learn javascript first.
What would be the default value for a Ajax call to get timed out in case of YUI.
I didn’t understand that why we link “demo.html” page in link.
If we remove that “demo.html” path from link, page is not working.
I want load the page only via YUI ajax…
u need to top-up money before you can yui.