dimanche 1 décembre 2019

select2 I don't want to get data out of json

My script won't load any data in the Select2. I made data from laravel controller with response JSON data, this result json



  "results": [
    {
      "id": 1,
      "code": "11",
      "name": "jackson",
    },
    {
      "id": 2,
      "code": "12",
      "name": "michael,

    },

this my script code

$('.name_user').select2({
      width: "100%",
      placeholder: "Search...",
        ajax: {
          url: "",
          processResults: function(data) {
            return {
              results: $.map(data, function(obj) {
                return {
                  id: obj.id,
                  name: obj.name
                };
              })
            };
          },
          cache: true
        }

      });

How do I get data from route name_user?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/33CJ7jV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire