| Conditions | 1 |
| Paths | 1 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | protected function initClientScript() |
||
| 51 | { |
||
| 52 | $id = $this->getId(); |
||
| 53 | $type = $this->type; |
||
| 54 | $url = Url::to(['@purse/generate-all']); |
||
| 55 | |||
| 56 | $this->view->registerJs(<<<"JS" |
||
| 57 | (function() { |
||
| 58 | function updateTable() { |
||
| 59 | var table = $('#{$id}'); |
||
| 60 | var loading = table.parents('.box').find('.loading'); |
||
| 61 | $.ajax({ |
||
| 62 | url: '{$url}', |
||
| 63 | method: 'POST', |
||
| 64 | data: {type: '{$type}'}, |
||
| 65 | dataType: 'html', |
||
| 66 | beforeSend: function( xhr ) { |
||
| 67 | loading.show(); |
||
| 68 | } |
||
| 69 | }).done(function (data) { |
||
| 70 | loading.hide(); |
||
| 71 | }); |
||
| 72 | } |
||
| 73 | setInterval(updateTable, 10000); |
||
| 74 | })(); |
||
| 75 | JS |
||
| 76 | , View::POS_END); |
||
| 77 | } |
||
| 78 | } |
||
| 79 |