Guest User

Untitled

a guest
Jul 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $('#tags').select2({
  2. placeholder: "Selecciona las etiquetas",
  3. ajax: {
  4. url: tagPublication,
  5. type: 'get',
  6. dataType: 'json',
  7. delay: 250,
  8. allowClear: true,
  9. data: function (params){
  10. return {
  11. term: params.term,
  12. };
  13. },
  14. processResults: function(data, params){
  15. return {
  16. results: data
  17. };
  18. },
  19. }
  20. });
  21.  
  22. public function selectType()
  23. {
  24. $type = Type::all();
  25. $select = [];
  26. foreach ($type as $data) {
  27. $select[] = ["id" => $data->id, "text" => $data->type_name];
  28. }
  29. return response()->json($select);
  30. }
Add Comment
Please, Sign In to add comment