Foros del Web » Programando para Internet » Jquery »

Mejorar función de comentarios

Estas en el tema de Mejorar función de comentarios en el foro de Jquery en Foros del Web. Cuando envio un nuevo comentario el cuadro para realizar el mensaje siempre sale. Como hago que se quite cuando el mensaje se ha enviado? Código ...
  #1 (permalink)  
Antiguo 09/11/2013, 20:26
Avatar de ChatDelMundo  
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 11 años
Puntos: 1
Mejorar función de comentarios



Cuando envio un nuevo comentario el cuadro para realizar el mensaje siempre sale.

Como hago que se quite cuando el mensaje se ha enviado?

Código PHP:
function comment_form($stream_id$flag '') {
    global 
$config$client;
    if (!
$client['id']) {
        return 
'<div>&gt;&gt;'.url('member/login',t('Login to comment') ).'</div>';
    }
    if (!
$flag$flag t('Comment');
    if (!
$config['comment_headed']) {
        
$comment_head =  
        
'
                <script>
                $(document).ready( function(){
                                                
                                                $("a[class=comment_delete]").click( function () {
var parentdd = $(this).parents(".user_comment");
var sid = $(this).prev()[0].value;
$(this).after("<img src=\''
.uhome().'/files/loading.gif\' /> hiding..");
$(this).hide();
$.get(\''
.uhome().'/index.php?p=jquery/comment_delete/\'+sid, function(data) {
parentdd.hide("slow");
});
return false;
});
                        $(".quick_comment").click(function() {
                                $(this).next().next().css("display","block");
                                $(this).next().next().find(".commentmessage").focus();
                                return false;
                        });
                        $(".commentsubmit").click(function() {
                            if ($(this).prev()[0].value != "") {
                                var thiscomment = $(this).parents(".quick_comment_form");
                                var cbox = thiscomment.next().next();
                                var mbox = thiscomment.find(".commentmessage");
                                var tbox = thiscomment.next();
                                cbox.html("<img src=\"'
.uhome().'/files/loading.gif\" /> Submitting");
                                $.post("'
.uhome().'/index.php?p=jquery/comment_publish",
                                {message:mbox[0].value,target_id:tbox[0].value},
                                  function(data){
                                    cbox.html("");
                                    cbox.after(data);
                                    mbox.attr("value","");
                                    },"html"
                                );
                                return false;
                            }
                        });
                        $(".dolike").click(function() {
                            var thiscomment = $(this).next();
                            var cbox = thiscomment.next().next();
                            var tbox = thiscomment.next();
                            cbox.html("<img src=\"'
.uhome().'/files/loading.gif\"/> Submitting");
                            $.post("'
.uhome().'/index.php?p=jquery/dolike",
                            {target_id:tbox[0].value},
                              function(data){
                                cbox.html("");
                                cbox.after(data);
                                },"html"
                            );
                            $(this).css("display","none");
                            return false;
                        });
                });
                </script>
                '
;
            
$config['comment_headed'] = 1;
    }
    
$res sql_query("select * from ".tb()."liked where stream_id='$stream_id' and uid='{$client['id']}' limit 1");
    if (
sql_counts($res)) {
        
$likeit '<a href="#" class="dolike">'.t('Unlike').'</a>';
    }
    else {
        
$likeit '<a href="#" class="dolike">'.t('Like').'</a>';
    }


        return 
$comment_head.'
        <div>
        <a href="#" class="quick_comment">+'
.$flag.'</a> | '.$likeit.'
            <div class="quick_comment_form" style="display:none;">
                <table border="0"><tr><td valign="top">
                <img src="'
.uhome().'/uploads/avatars/s_'.$client['avatar'].'" width="25" height="25" />
                </td><td>
                <textarea name="message" rows="2" class="fpost commentmessage""  style="width:350px;" ></textarea>
                <input type="button" value=" '
.$flag.' " class="fbutton commentsubmit" />
                </td></tr>
                </table>
            </div>
            <input type="hidden" name="wall_id" value="'
.$stream_id.'" />
            <div></div>
        </div>'
;
        } 
alguien me puede ayudar?
__________________
chatdelmundo.es
  #2 (permalink)  
Antiguo 10/11/2013, 15:27
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: Mejorar función de comentarios

Si estás enviando el comentario por AJAX, necesitarás ocultar el formulario con Javascript; muevo tu tema al foro adecuado.
__________________
- León, Guanajuato
- GV-Foto
  #3 (permalink)  
Antiguo 10/11/2013, 16:38
Avatar de ChatDelMundo  
Fecha de Ingreso: abril-2013
Mensajes: 98
Antigüedad: 11 años
Puntos: 1
Respuesta: Mejorar función de comentarios

Cita:
Iniciado por Triby Ver Mensaje
Si estás enviando el comentario por AJAX, necesitarás ocultar el formulario con Javascript; muevo tu tema al foro adecuado.
Que codigo javascript uso?
__________________
chatdelmundo.es

Etiquetas: comentarios, html, mejorar, php, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:59.