Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] New to YUI; AJAX question

Expand Messages
  • Dean Jennings
    Try the example at http://developer.yahoo.com/yui/examples/container/panel-loading.html It s a different approach but uses YUI capabilities and should give you
    Message 1 of 2 , Sep 26, 2008
    • 0 Attachment
      Try the example at
      http://developer.yahoo.com/yui/examples/container/panel-loading.html

      It's a different approach but uses YUI capabilities and should give you
      a good example of how the panel controls work.



      cp_ru wrote:
      >
      > Hi all,
      >
      > The CSS Grids project introduced me to YUI (which I like a lot) and I
      > trying to evaluate if I want to use other parts of YUI. I've
      > primarily done my JS using MooTools, however I can't seem to figure
      > out how to port the following with YUI:
      >
      > function showLoading() {
      > if ($('loading')) {
      > $('loading').setStyle('display', '');
      > } else {
      > parent.document.getElementById('loading').style.display = '';
      > }
      > }
      >
      > function hideLoading() {
      > if ($('loading')) {
      > $('loading').setStyle('display', 'none');
      > } else {
      > parent.document.getElementById('loading').style.display = 'none';
      > }
      > }
      >
      > function showThumb(x) {
      > showLoading();
      > var sku = x;
      > new Ajax('/image/show_thumbnail/'+sku, {
      > method: 'get',
      > evalScripts: true,
      > update: 'thumbnail',
      > onComplete: hideLoading,
      > }).request();
      > }
      >
      > Bascially what this does is update <div id="thumbnail> with the result
      > of a server side action '/image/show_thumbnail/<sku>'. The
      > showLoading() is called first to display a <div> at the top of the
      > screen with a z-index of 1, and then hides the <div> after the server
      > side action has completed.
      >
      > Thanks
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.