How should I do to match with Ajax example on PHP?


#1

Hi everyone!

At this page Select2 shows us how to retrieve information from an API (PHP and so on) via Ajax.

How should I send an array from PHP to match with this example?
I tried with
$response_body = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); $response = new Response( $response_body, 200 ); return $response;

where $data is an array (of course!).

Best regards.

Using: https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js


#2

This issue was solved.

I don’t know how to delete it.

Brs.