弹出按钮未在Laravel

时间:2017-11-10 06:44:49

标签: javascript laravel popup

我目前正在尝试制作一个弹出窗体,出于某种原因,我的表单只是让我空白。我目前正在关注this website

当我查看视图页面源时,所有代码仍然存在,但刀片中没有显示任何内容。它只是空白。假设有弹出按钮显示

这是我的刀片:

evaltest.blade.php

 <html>
    <head> 
        <title>Popup contact form </title>
        <meta name="robots" content="noindex, nofollow">    
        <link href="{{ asset('css/elements.css') }}" rel="stylesheet">
        <script src="js/my_js.js"></script> 
        <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-43981329-1']);
        _gaq.push(['_trackPageview']);
        (function () {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
        })();
    </script>
    </head> 
     <!-- body starts here -->
     <body id ="bdy" style="overflow:hidden;">

     <div id="abc">

         <!-- Popup div starts here -->
     <div id="popupContact"> 

        <!-- contact us form -->
             <form class="form-horizontal" method="post" action="{{ url('/evaltest/'.$data->id) }}">
            {{ csrf_field() }}
             <input type="hidden" name="user_id" value="{{$data->id}}">

         <div class="form-group">
            <label class="col-md-2"><b>Recommendation:</b></label>
          <div class="col-md-6">
            <input type="radio" id ="recommendation" name="recommendation" value="Yes"> Yes<br>
            <input type="radio" id ="recommendation" name="recommendation" value="No"> No<br>
          </div>

                          <div class="form-group">
            <label class="col-md-2"><b>Training Schedule:</b></label>
          <div class="col-md-6">
            <input type="radio" id = "training_schedule" name="training_schedule" value="Yes"> Yes<br>
            <input type="radio" id = "training_schedule" name="training_schedule" value="No"> No<br>
            <input type="radio" id = "training_schedule" name="training_schedule" value="NIL"> NIL<br>
          </div>

                                <div class="form-group">
            <label class="col-md-2"><b>Training Date (key in date if yes or pending, else just say nil and leave the date):</b></label>
          <div class="col-md-6">
            <input type="date" id = "training_date" name="training_date" class="form-control">
            <input type="text" id = "training_date" name="training_date" class="form-control">
          </div>        
                <a id="submit" href="javascript: check_empty()">Send</a>
            </form>
     </div> 
    <!-- Popup Div Ends Here -->
    </div>
    <!-- Display Popup Button -->
    <h1>Click Button To Popup Form Using Javascript</h1>
    <button id="popup" onclick="div_show()">Popup</button>
    </body>
    <!-- Body Ends Here -->
    </html>

这是我正在使用的控制器:

     public function getEval1(){
       $data = personal_info::whereDoesntHave('evaluations')->first();
       if(count($data)>0){
        return view('evaltest',compact('data'));
    }else{
    return view('evaltest');
}

以下是路线:(如果需要)

Route::get('/user/showupdate8/{id}/evaltest', 'evalController@getEval1');
Route::post('/evaltest/{id}', 'evalController@eval');

对于JavaScript和CSS,我只是从网站上复制和粘贴,所以没有任何区别。但对于JavaScript,我只用我的id替换了他们的id,而其余的保持不变。

1 个答案:

答案 0 :(得分:1)

首先纠正你的js包含代码

<script src="{{ asset('/js/my_js.js) }}"></script> 

如果在网页的页脚区域中包含js代码将会很好。