Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/08/2011, 15:33
programando
 
Fecha de Ingreso: agosto-2009
Mensajes: 21
Antigüedad: 14 años, 8 meses
Puntos: 0
insertar comentarios

hola
me gustaria que me ayudaran en algo......
lo que pasa es que tengo un txttarea donde se copian los comentarios al momento de guardar ese comentario me lo muestra en la pagina y lo guarda....la parte en que quiero que me ayuden es que al mostrar el comentario en la pagina este sea mostrado arriba de cada comentario agregado....EL PROBLEMA ES QUE ME LOS MUESTRA ABAJO DE CADA COMENTARIO AGREGADO................................

aqui les dejo el codigo que utlizo para insertar
y un ejemplo en una pagina [URL="http://anibalajt.zobyhost.com/inicio.php"]ejemplo[/URL]

Código PHP:
$(document).ready(function(){
    
/* The following code is executed once the DOM is loaded */

    /* This flag will prevent multiple comment submits: */
    
var working false;

    
/* Listening for the submit event of the form: */
    
$('#addCommentForm').submit(function(e){

         
e.preventDefault();
        if(
working) return false;

        
working true;
        $(
'#submit').val('Working..');
        $(
'span.error').remove();

        
/* Sending the form fileds to submit.php: */
        
$.post('submit.php',$(this).serialize(),function(msg){

            
working false;
            $(
'#submit').val('Submit');

            if(
msg.status){

                
/*
                /    If the insert was successful, add the comment
                /    below the last one on the page with a slideDown effect
                /*/

                
$(msg.html).hide().insertBefore('#aa').slideDown();
                $(
'#body').val('');
                                
                $(
msg.html).hide().insertBefore('').slideDown();
            }
            else {

                
/*
                /    If there were errors, loop through the
                /    msg.errors object and display them on the page
                /*/

                
$.each(msg.errors,function(k,v){
                    $(
'label[for='+k+']').append('<span class="error">'+v+'</span>');
                });
            }
        },
'json');

    });

});