Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/04/2012, 22:00
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 14 años, 6 meses
Puntos: 6
Como envio datos por ajax utilizando ventana modal

Hola amigos del foro necesito enviar 4 datos via ajax y estoy utilizando una ventana modal como hago para enviarlos?





Código Javascript:
Ver original
  1. select: function(start, end, allDay) {
  2.            
  3.          $("#dialog-form").dialog('open');
  4.          $( "#dialog:ui-dialog" ).dialog( "destroy" );
  5.          //$("#date-start").val($.fullCalendar.formatDate(start, 'MM/dd/yyyy'));
  6.          $("#start").val(start);
  7.          $("#end").val(end);
  8.          //$("#date-end").val($.fullCalendar.formatDate(end, 'MM/dd/yyyy'));
  9.         $("#allDay").val(allDay);
  10.        
  11.          
  12.          
  13.         $( "#dialog-form" ).dialog({
  14.             autoOpen: false,
  15.             height: 600,
  16.             width: 680,
  17.             modal: true,
  18.             buttons: {
  19.                 "Crear Nuevo Evento": function() {
  20.                   //$( this ).dialog( "close" );
  21.                  
  22.                    
  23.                 },
  24.                 Cancelar: function() {
  25.                     $( this ).dialog( "close" );
  26.                 }
  27.             },
  28.             close: function() {
  29.                 allFields.val( "" ).removeClass( "ui-state-error" );
  30.             }
  31.         });
  32.  
  33.         /*$( "#create-user" )
  34.             .button()
  35.             .click(function() {
  36.                 $( "#dialog-form" ).dialog( "open" );
  37.             });*/
  38.  
  39.        },
  40.            
  41.             editable: false,


<div id="dialog-form" title="Crear Nuevo Evento">
<p class="validateTips"></p>

<form>
<fieldset>
<fieldset>
<label for="name">Evento</label>
<input type="text" name="title" id="title" class="text ui-widget-content ui-corner-all" />
</fieldset>

<span class="inline"><input type="text" name="start" id="start" class="text ui-widget-content ui-corner-all"></span>
<span class="inline"><input type="text" name="end" id="end" class="text ui-widget-content ui-corner-all"></span>
<span class="inline"><input type="text" name="allDay" id="allDay" class="text ui-widget-content ui-corner-all"></span>
</form>
</div>


antes tenia este codigo y enviaba los datos sin problemas utilizando ajax
ahora necesito enviarlos con la ventana modal


Código Javascript:
Ver original
  1. select: function(start, end, allDay) {
  2.                 var title = prompt('Evento:');
  3.                 if (title) {
  4.                     $.ajax({
  5.                          url:'archivo.php',
  6.                          type:'post',
  7.                          data:{
  8.                             title: title,
  9.                             start: start.toUTCString(),
  10.                             end: end.toUTCString(),
  11.                             allDay: allDay,
  12.                             }
  13.                        
  14.                     }).done(function(data) {
  15.                         //alert("Evento Guardado");
  16.                          //alert("Datos guardados, respuesta: " + start);
  17.                     });
  18.                    
  19.                    
  20.                     //calendar.fullCalendar('renderEvent',
  21.                       calendar.fullCalendar('refetchEvents',
  22.                         {
  23.                            
  24.                             title: title,
  25.                             start: start,
  26.                             end: end,
  27.                             allDay: allDay,
  28.                        
  29.                            
  30.                         },
  31.                         true // make the event "stick"/ make the event "stick"
  32.                        
  33.                     );
  34.                 }
  35.                 calendar.fullCalendar('unselect');
  36.                
  37.             },