Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <select name="id_group" id="select_group" class="form-control" style="text-align-last: center;" required>
  2. <option value='115'>115</option>
  3. </select>
  4. /*Для View-ера*/
  5. $.ajax({
  6. url: "<?php echo base_url("panel/ajax_loading_groups") ?>",
  7. type: "post",
  8. dataType: "html",
  9. success:function(data){
  10. $('#select_group').fadeTo("fast", 0).delay(500).fadeTo('fast',1).html(data);
  11. $('#select_group').val(" ");
  12. },
  13. error: function(xhr, status, error) {
  14. console.log(xhr)
  15. console.log(error);
  16. }
  17. });
  18. /*Controller*/
  19. public function loading_groups(){
  20. $this->load->helper('form');
  21. if(logged_in()){
  22. if(check_rules()){
  23. if ($groups = R::getAll('select * from students')){
  24. $result = unique_multidim_array($groups, 'id_course');
  25. foreach($result as $item){
  26. $data .= '<option value='.$item['id_course'].'>'.$item['id_course'].'</option>';
  27. }
  28. }else{
  29. $data = '<div class="<div class="alert alert-danger" role="alert">Курсы студентов не найдены!' . '</div>';
  30. }
  31. echo $data;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement