Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/02/2013, 09:01
Avatar de rottenp4nx
rottenp4nx
 
Fecha de Ingreso: octubre-2012
Ubicación: Santiago
Mensajes: 417
Antigüedad: 11 años, 6 meses
Puntos: 36
Respuesta: Animacion mientras envía formulario

Primero al div carga colocale la propiedad css display en none, como default, para que funcione el siguiente código

Código Javascript:
Ver original
  1. $("#send").click(function(){
  2. var texto = $("#texto").val();
  3. $.ajax({
  4. type: "POST",
  5. url: "cuenta.jsp",
  6. data: "texto=" + texto,
  7. beforeSend: function(){
  8.    $("#carga").show("slow");
  9. },
  10. success: function(msg){
  11. $("#carga").hide("slow",function(){
  12. $("span#resultado").text(msg);
  13. });
  14. },
  15. error: function(xml, msg){
  16. $("span#resultado").text("Error");
  17. }
  18. });
  19. });
  20. });
  21. </script>

Con ese script hará lo que necesitas, saludos!

PD: No uses colores para el código, para poder leerlo bien