jquery - success or fail popup -


i have php class show suceess message or fail message after action (posting form/updating page) refreshes page , psts either 1 or 0 , following code - - how can pop , auto close...just green tick or cross.....assume need use jquery - - totally lost here advise welcome...thanks

   <?     $response = $_get['response'];     if ($response == '0') {     echo"     <div class=\"error message\">                  <h5>fyi, happened!</h5>                  <p>this info notification message.</p>     </div>     ";     }     if ($response == '1') {     echo"     <div class=\"success message\">                  <h5>fyi, happened!</h5>                  <p>this info notification message.</p>      </div>     ";     }     ?> 

first try http://jsfiddle.net/tanducar/bj6l9/1/

if getting popup message through ajax then... here code

$(document).ready(function(){          ... ajax call here          success: function(data){             var popup= $('<div>');             popup.append(data);             $('body').append(popup);             popup.css("position","absolute");             popup.css("top", ($(window).height() - popup.height() ) / 2+ $(window).scrolltop() + "px");             popup.css("left", ($(window).width() - popup.width() ) / 2+ $(window).scrollleft() + "px");              popup.fadeout(3000);          }      ......  }) 

write php code within javascript.

    <script>     $(document).ready(function(){ <?php     $response = $_get['response'];      if ($response == '0') { ?>       var data = $('<div class="success message"><h5>fyi, happened!</h5> <p>this info notification message.</p> </div>');     <?php }          if ($response == '1') {?>        var data = $('<div class=\"success message\"><h5>fyi, happened!</h5><p>this info notification message.</p> </div>');     </div>     <?} ?>        var popup= $('<div>');      popup.append(data);      $('body').append(popup);      popup.css("position", "absolute");      popup.css("top", ($(window).height() - popup.height()) / 2 + $(window).scrolltop() + "px");      popup.css("left", ($(window).width() - popup.width()) / 2 + $(window).scrollleft() + "px");      popup.fadeout(2000);     });      </script> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -