Foros del Web » Programando para Internet » Javascript » Frameworks JS »

problemas con ajax de mi textarea e input

Estas en el tema de problemas con ajax de mi textarea e input en el foro de Frameworks JS en Foros del Web. hola tengo mi codigo ajax de javascript el cual no me funciona del un campo input y textarea @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Javascript : Ver original ...
  #1 (permalink)  
Antiguo 10/09/2011, 13:58
 
Fecha de Ingreso: abril-2010
Mensajes: 151
Antigüedad: 14 años
Puntos: 1
problemas con ajax de mi textarea e input

hola tengo mi codigo ajax de javascript el cual no me funciona del un campo input y textarea

Código Javascript:
Ver original
  1. var muro = {
  2. show_comment_box: function(id){
  3.         $('#cb_' + id).show()  
  4.     },
  5.  
  6.  
  7. comentar: function(id){
  8.         var val = $('#cf_' + id).val();
  9.         muro.stream.status = 1;
  10.         if(val == '' || val == $('#cf_' + id).attr('title')) {
  11.             $('#cf_' + id).focus();
  12.             // LOADER/ STATUS
  13.             muro.stream.loader(false);
  14.             muro.stream.status = 0;
  15.             return false;
  16.         }
  17.         //
  18.         $.ajax({
  19.             type: 'POST',
  20.             url: global_data.url + '/muro-coment.php?do=repost',
  21.             data: 'data=' + encodeURIComponent(val) + '&pid=' + id,
  22.             success: function(h){
  23.                 switch(h.charAt(0)){
  24.                     case '0': //Error
  25.                         mydialog.alert('Error:', h.substring(3));
  26.                         break;
  27.                     case '1': //OK
  28.                         $('#cl_' + id).append(h.substring(3));
  29.                         $('#cf_' + id).val('');
  30.                         break;
  31.                 }
  32.             },
  33.             complete: function (){
  34.                 // STATUS
  35.                 muro.stream.status = 0;
  36.             }
  37.         });
  38.     },
  39.  
  40. }
  41.  
  42. /** READY **/
  43. $(function(){
  44.  
  45.     // RESPUESTAS
  46.     $('.comentar').css('max-height', '200px').autogrow().css('height','14px');
  47.     //
  48.     $('input[name=hack]').live("focus",function(){
  49.         $(this).hide();
  50.         $(this).parent().find('div.formulario').show();
  51.         var pub_id = $(this).attr('pid');
  52.         //
  53.         $('#cf_' + pub_id).focus()
  54.     })
  55. });


codigo el cual quiero que cuando comente escriban dentro de campo den a la tecla enter y me haga el ajax insertando un comentario

Código PHP:
 <li class="ufiItem">
                                                    <div class="newComment">
                                                        <input type="text" class="ui-corner-all form-input-text box-shadow-soft" name="hack" placeholder="Escribe un comentario..." pid="<?php echo $row['pub_id']; ?>" />
                                                        <div class="formulario" style="display:none">
                                                            <img src="<?php echo $this->tsConfig['url'];?>/files/avatar/<?php echo $this->tsUser->uid ?>_50.jpg" width="32" height="32"/>
                                                            <textarea class="comentar ui-corner-all form-input-text box-shadow-soft" placeholder="Escribe un comentario..." id="cf_<?php echo $row['pub_id']; ?>" pid="<?php echo $row['pub_id']; ?>" name="add_wall_comment"></textarea>
                                                            <div class="clearBoth"></div>
                                                        </div>
                                                    </div>
                                                </li>

Etiquetas: ajax, enter_frame, php+ajax+formularios, javascript
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 17:30.