Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/10/2012, 11:53
charlyta
 
Fecha de Ingreso: junio-2008
Mensajes: 291
Antigüedad: 15 años, 10 meses
Puntos: 9
Pasar variable a funcion

hola, no consigo pasar las variables de un link a esta función:

antes lo llamaba así haciendo otra función:

Código PHP:
<class='ico ico-edit' rel='$directory' href='#'  id='$file' value='delete$count'><span></span></a
Pero ahora lo intento así:

Código PHP:
<class='ico ico-resize'  rel='$directory' href='#'  id='$file' value='delete$count'><span></span></a



funcion:

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3.   var fname=$(this).attr("id");
  4.   var directory=$(this).attr("rel");
  5.   var deletecount=$(this).attr("value");
  6.     // Damos formato a la Ventana de Diálogo
  7.     var dialog = $("#dialog").dialog({
  8.         // Indica si la ventana se abre de forma automática
  9.         autoOpen: false,
  10.         // Indica si la ventana es modal
  11.         modal: true,
  12.         // Largo
  13.         width: 400,
  14.         // Alto
  15.         height: 280,
  16.         // Creamos los botones
  17.         buttons: {
  18.            
  19.             'Versión PHP': function() {
  20.                
  21.                 // Mostrar Versión de PHP
  22.                 $.ajax({
  23.                     // Antes de realizar la llamada mostramos el ajax load
  24.                     beforeSend: function(){
  25.                         $('#respuestaAjax').html('<img id="loader" src="images/loading.gif"/>');
  26.                     },
  27.                     cache: false, // Indicamos que no se guarde en cache
  28.                     type: "GET", // Variables GET
  29.                     url:"delete_img.php", // srcript a ejecutar
  30.                     data: {"file":fname,"directory":directory},  // paso de datos
  31.                     // cuando es exitoso el llamado
  32.                     success: function(response){
  33.                         $('#respuestaAjax').html(response);
  34.                         $('#' + deletecount).remove();
  35.                             dialog.dialog( "close" );
  36.                            
  37.                     }
  38.                 });
  39.             },
  40.             Cerrar: function() {
  41.                 // Cerrar ventana de diálogo
  42.                 dialog.dialog( "close" );
  43.             }
  44.  
  45.         }
  46.     });
  47.     $("a.ico-resize").click( function(e) {
  48.   // e.preventDefault();
  49.   // dialog.dialog("open");
  50.   dialog.dialog('open');
  51.   var fname=$(this).attr("id");
  52.   var directory=$(this).attr("rel");
  53.   var deletecount=$(this).attr("value");
  54.         // prevent the default action, e.g., following a link
  55.         return false;
  56. });
  57.  
  58. });
  59.                        
  60. </script>