Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/07/2013, 20:48
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: laravel y Ajax

masterpuppet gracias por responder

estoy implementando lo que me enviaste http://codehappy.daylerees.com/ajax-content pero no logro hacerlo que funcione

este es mi codigo users.blade.php
Código PHP:
Ver original
  1. @extends('layout')
  2. @section('content')
  3. <br>
  4. <br>
  5. <br>
  6. <div class="container">
  7. <h3>Último Registro</h3>
  8.    <p>{{ $users->id }}</p>
  9.    <p>{{ $users->email }}</p>
  10. </div>
  11.  
  12. <div id="content">
  13. <p>Hello and welcome to the site!</p>
  14. </div>
  15. <a href="#" id="load-content">Load Content</a>
  16. @stop

layout.blade.php
Código PHP:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. {{ HTML::style('css/bootstrap.css') }}
  5.  
  6. {{ HTML::script('js/jquery-1.10.1.min.js')}}
  7. {{ HTML::script('js/script.js')}}

script.js
Código Javascript:
Ver original
  1. $(document).ready(function() {
  2. $('#load-content').click(function(e) {
  3.    
  4.     e.preventDefault();
  5.     $.get(BASE+'content', function(data) {
  6.     $('#content').html(data);
  7.     });
  8.     })
  9. });


content.blade.php
Código PHP:
Ver original
  1. <h1>New Content</h1>
  2. <p>This is our AJAX loaded content.</p>

routes.php
Código PHP:
Ver original
  1. Route::get('content', function() {
  2. return View::make('content');
  3. });