Ver Mensaje Individual
  #17 (permalink)  
Antiguo 19/01/2010, 12:36
manzabud
 
Fecha de Ingreso: julio-2009
Mensajes: 16
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: case con ajax

Es mas mira probando yo podriamos hacer algo asi:

Código HTML:
Ver original
  1. <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  2. <script type="text/javascript">
  3. $(function(){
  4. * $('a[rel=ajax]').bind('click', function(){
  5. * * document.location.href='#'+this.href;
  6. * * // ejecutamos el ajax...
  7.  
  8. * * return false;
  9. * });
  10. });
  11.  
  12.  
  13. <script type="text/javascript">
  14.     var str = (document.location.href).toString().split('#');
  15.     var script = str[1]; // inbox.php?mg=st
  16.  
  17.    $.ajax({
  18.             url: script,   
  19.             type: "GET",       
  20.             data: data,    
  21.             cache: false,
  22.             success: function (html) { 
  23.                 $('.loading').hide();              
  24.                 $('#content').html(html);
  25.                 $('#body').fadeIn('slow');     
  26.        
  27.             }      
  28.         });
  29.  
  30. <a href="ajaxcase.php?q=v" rel="ajax">enlace</a>
  31.  
  32.  
  33. <?php
  34. switch ($_GET['q']) {
  35.    case 'v':
  36.        echo "works";
  37.        break;
  38.  
  39.    default:
  40.       echo "do it";
  41. }
  42. ?>
  43. </body>


pero corrigeme en lo qu eeste mal porfavor.. he estado mirando varias paginas y praticamente hacen lo que yo quiero pero no es tal cual lo quiero.. por ejemplo ellos trabajan directamente con el signo numeral en el link pero yo quiero algo mas profesional y con variables get asi como esto:

Código HTML:
Ver original
  1. <a href="ajaxcase.php?q=v" rel="ajax">enlace</a>

y NO asi:

Código HTML:
Ver original
  1. <a href="#page1" rel="ajax">enlace</a>