如何在laravel中使用ajax显示刀片页面?

时间:2015-02-27 10:25:38

标签: php jquery ajax laravel-4

我在Laravel 4.2中遇到了我的ajax和刀片问题。我无法使用ajax显示此特定刀片(如下所示)。 我使用相同的方法来显示另一个页面,也是成功的。

这是我发送ajax请求的视图

<td>{{HTML::linkRoute('campaign.preview','Run>>',$list1->id,['class'=>'button tiny radius','data-reveal-id'=>'comment-show','data-reveal-ajax'=>'true']) }}

路线

    Route::model('list1', 'List1');

    Route::model('campaign', 'Campaign');

    Route::model('template','Template');

    Route::get('/campaigns/{list1}/preview',[
    'as' => 'campaign.preview', 
    'uses' => 'CampaignController@previewCampaign'
    ]);

控制器

public function previewCampaign(List1 $list1s)
{
    $tid = Session::get('template');
    $templates = Template::find($tid);
    if (Request::ajax()){

        return View::make('campaigns.preview')
        ->with(compact('list1s'))
        ->with(compact('templates'));
    }
}

必须查看的刀片

 <p> <font size="5" face="verdana" color="green">{{{$templates->title}}}</font></p>
 <p> <b><font size="5" face="Comic Sans MS" color="#8904B1">{{{$templates->description}}}</font></b></p>
 <p><figure>
       <img width="720" height="900" src='{{ asset($templates->detailImageURL) }}'> 
 </figure></p>

 <p><b>Expires on:&nbsp;</b><font  face="verdana" color="red"> {{{$templates->end_date}}}</FONT></p>

 <p><b>Click here to claim the offer:</b><a href='{{$templates->targetURL}}'>&nbsp;{{$templates->targetURL}}</a></p>
 <p><b><font size="2" face="verdana" color="blue">Do you want to run this campaign on {{{$list1s->name}}} ?</font></b></p>
 <span class="right">&nbsp; &nbsp;{{ HTML::link('user/campaigns/save','Yes',['class' => 'button tiny radius']) }}</span>&nbsp; &nbsp;<span class="right">{{ HTML::link('user/campaigns/new','No',['class' => 'button tiny radius']) }}     </span>
  </p>
  <a class="close-reveal-modal">&#215;</a>

当我尝试运行此代码时,页面没有显示,但只会淡化显示。 有关我的问题的任何建议吗?

0 个答案:

没有答案