Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What's wrong with this jquery POST
  2. $(document).ready(function(){
  3.    $('input.atualizar').click(function(){
  4.       var observacoes = $('textarea#textarea_observacoes').val();
  5.       var pac_id = $('input#member_id').val();
  6.       var tipo = 'observacoes';
  7.  
  8.         $.post("pacientes/update", { "observacoes" : observacoes, "pac_id" : pac_id, "tipo" : tipo },
  9.         function(data){
  10.             alert(data.result);
  11.             alert('aaaa');
  12.         }, "json");
  13.    });
  14.  
  15. });
  16.        
  17. function update(){
  18.         $ar = array(
  19.             'observacoes' => $this->input->post('observacoes'),
  20.             'pac_id' => $this->input->post('pac_id'),
  21.             'tipo' => $this->input->post('tipo')
  22.         );
  23.         echo json_encode($ar);
  24.     }
  25.        
  26. <div class="fail" style="display: none;z-index:999">
  27.         <div>
  28.             Error....
  29.             <div id="errorTextMsg">
  30.             </div>
  31.         </div>
  32.     </div>
  33. <script>
  34.    $(".fail").ajaxError(function (event, xhr, status, error) {
  35.                 $("#errorTextMsg").html(xhr.responseText);
  36.                 $(this).show();
  37.             })
  38.  
  39. });
  40. </script>
  41.        
  42. input.atualizar
  43.        
  44. input.actualizar