Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo $form->select2Row($model, 'contract_id', [
- 'data' => [],
- 'multiple' => false,
- 'id' => 'contract',
- 'required' => true,
- 'empty' => '',
- 'ajax' => [
- 'type' => 'POST',
- 'dataType' => 'json',
- 'url' => CController::createUrl('Request/services'),
- 'success' => 'function(data) {
- var newOptions = "";
- var services = data.services;
- console.log(services);
- $.each(services, function(index, value){
- newOptions += "<option value=" + value.id + ">" + value.text + "</option>";
- });
- $("#service").select2("destroy").html(newOptions).select2();
- $("#service").select2().select2({"width":"220px"});
- }',
- ]
- ]);?>
Advertisement
Add Comment
Please, Sign In to add comment