我有一个文件edit.blade.php。我想在加载ajax
的div中加载内容@if(Auth::check() && Auth::user()->admin)
@section('modal_body')
@if($errors->any())
<div class='alert alert-danger'>
<a href="#" class="close" data-dismiss="alert">×</a>
@foreach($errors->all() as $error)
{{ $error }} <br/>
@endforeach
</div>
@endif
{{ Form::open(array('id' =>'formuser-create', 'role' => 'form', 'class' => 'form-horizontal')) }}
<div class="form-group">
{{ Form::label('user', 'Nombre de usuario', array('class' => 'col-md-4 control-label')) }}
<div class="col-md-5">
{{ Form::text('user','', array('placeholder' => 'Introduce la contraseña...', 'class' => 'form-control input-md')) }}
<div id="user_error"></div>
</div>
</div>
<div class="form-group">
{{ Form::label('email', 'Email', array('class' => 'col-md-4 control-label')) }}
<div class="col-md-5">
{{ Form::text('email','', array('placeholder' => 'Introduce el email...', 'class' => 'form-control input-md')) }}
<div id="email_error"></div>
</div>
</div>
<div class="form-group">
{{ Form::label('es_admin', '¿Es administrador?', array('class' => 'col-md-4 control-label')) }}
<div class="col-md-5">
{{ Form::checkbox('es_admin','1') }}
</div>
</div>
@stop
我想在div中加载内容,但不能加载
这里是我调用load的文件,但是我得到了如何找不到响应状态404
var modal_title = $(this).find('.modal-title');
var modal_body = $(this).find('.modal-body');
//var modal_footer = $(this).find('.modal-footer');
switch(accion)
{
case 'create':
modal_title.html('<i class="fa fa-user-plus"></i> Nuevo usuario');
break;
case 'edit':
modal_title.html('<i class="fa fa-pencil fa-fw"></i> Editar usuario');
modal_body.load('includes/edit.blade.php');
break;
抛出的错误是:
Failed to load resource: the server responded with a status of 404 (Not Found)
答案 0 :(得分:0)
你不能那样做。您需要创建一个路由,并让路由为您返回视图:
case 'edit':
modal_title.html('<i class="fa fa-pencil fa-fw"></i> Editar usuario');
modal_body.load('some/route/edit');
break;
然后在您的路线(或控制器)
Route::get('some/route/edit', function() {
return View::make('includes/edit');
});