IgorKorytin

Untitled

Sep 5th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1.  <div class="span8">
  2.                     <label><b>Выберите услугу</b></label>
  3.                     <?php
  4.                     $list_data = services::all();
  5.                     echo CHtml::dropDownList('services', null, $list_data, array('class' => 'span15',
  6.                     'ajax' => [
  7.                     'type' => 'POST',
  8.                     'dataType' => 'json',
  9.                     'url' => CController::createUrl('Request/payservices'),
  10.                         'success' => 'function(data) {
  11.                                    var newOptions = "";
  12.                                    var services = data.services;
  13.                                    console.log(services);
  14.                                    $.each(services, function(index, value){
  15.                                        newOptions += "<option value=" + value.id + ">"  + value.text + "</option>";
  16.                                    });
  17.                                    $("#service").select2("destroy").html(newOptions).select2();
  18.                                    $("#service").select2().select2({"width":"220px"});
  19.                                }',
  20.                     ])
  21.                     );
  22.                     ?>
  23.  
  24.                 </div>
Advertisement
Add Comment
Please, Sign In to add comment