duanqian9503
2017-10-18 16:34
浏览 62
已采纳

如果我正在使用laravel,如何在ajax中编写@if

Here I need a help how to write @if role in the javascript if Im using Laravel and the code in laravel as you see but I want to write the same code in the ajax section

Laravel code:

 <td class="text-center">@if ($post->adver_position==0) TOP @endif @if ($post->adver_position==1) RIGHT @endif @if ($post->adver_position==2) LEFT @endif @if ($post->adver_position==3) BOTTOM @endif</td>

Ajax:

      $('.item' + data.id).replaceWith("<tr class='item" + data.id + "'><td  class='col1'>" + data.id + "</td><td><img src='images/" + data.adver_photo + "'style='width: 50%;margin-left: 35px;border-radius: 3px;border: 1px solid #1a2732;' /></td><td>" + data.adver_title + "</td>"
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题