Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 为什么未在浏览器的视图(刀片)文件中更新触发的推送器数据?_Jquery_Laravel 5 - Fatal编程技术网

Jquery 为什么未在浏览器的视图(刀片)文件中更新触发的推送器数据?

Jquery 为什么未在浏览器的视图(刀片)文件中更新触发的推送器数据?,jquery,laravel-5,Jquery,Laravel 5,我有带3个div的刀片文件 欢迎使用.blade.php <div id="id1">0</div> <div id="id2">0</div> <div id="id3">0</div> <script> //pusher var pusher = new Pusher('xxxxxxxxxxxx', { clu

我有带3个div的刀片文件

欢迎使用.blade.php

 <div id="id1">0</div>
 <div id="id2">0</div>
 <div id="id3">0</div>
 <script>
    //pusher
    var pusher = new Pusher('xxxxxxxxxxxx', {
        cluster: 'eu',
        encrypted: true
      });
   // Subscribe to the channel we specified in our Laravel Event
      var channel = pusher.subscribe('my-channel');
   // Binding a function to a Event
     channel.bind('App\\Events\\UpdatedTime', function(data){
      target = data.id;
      console.log(data);
      value = data.value;
      var div1 = document.getElementById(target);
      div1.innerHTML =value;
     });
</script>
Route::get('/getTime/{id}', 'App\Http\Controllers\TimeController@getTime');
事件文件

  public $id, $value;
    public function __construct($id, $value)
    {
       $this->id = $id;
       $this->value = $value;
    }
    public function broadcastOn()
    {
        return new Channel('my-channel');
    }
路由/web.php

 <div id="id1">0</div>
 <div id="id2">0</div>
 <div id="id3">0</div>
 <script>
    //pusher
    var pusher = new Pusher('xxxxxxxxxxxx', {
        cluster: 'eu',
        encrypted: true
      });
   // Subscribe to the channel we specified in our Laravel Event
      var channel = pusher.subscribe('my-channel');
   // Binding a function to a Event
     channel.bind('App\\Events\\UpdatedTime', function(data){
      target = data.id;
      console.log(data);
      value = data.value;
      var div1 = document.getElementById(target);
      div1.innerHTML =value;
     });
</script>
Route::get('/getTime/{id}', 'App\Http\Controllers\TimeController@getTime');
在浏览器中传递URL后,

我只能看见

0
0  
0
在浏览器中, 实际上,它应该在浏览器中

0
1511
0
如何在浏览器中获取触发的事件值? 有人能帮忙吗

谢谢