I developed a web application on Windows (XAMPP environment). Everything was working, but when I published it on a Linux Server I got a strange issue which is driving me mad. I've read all possible posts on SO, still i can't get the solution.
The problem is that all the select2 fields are not being updated by Ajax.
I am using select2 (ver. 3.x) populating it with jSON on searching. With PHP I return a jSON formatted set of data
header('Content-type: application/json');
...
echo json_encode(array(
'results' => $prepared_data,
'more' => (@db_num_rows($res) >= $results_per_page),
'elapsed' => round(microtime(true) - $start_ts, 3)
));
which is giving me a set of data in Chrome Inspector (Network -> Response) like:
{"results":[{"id":"8","text":"-- Scegli il Distretto --"},{"id":"3","text":"Distretto Centro"},{"id":"2","text":"Distretto Nord Est"},{"id":"1","text":"Distretto Nord Ovest"},{"id":"6","text":"Distretto Sardegna"},{"id":"7","text":"Distretto Sicilia"},{"id":"4","text":"Distretto Sud Est"},{"id":"5","text":"Distretto Sud Ovest"}],"more":false,"elapsed":0.109}
The only strange thing I notice is that before that string I can see a small dot in the Chrome network console response. Hovering it with the mouse I read it is \ufeff. There is no error in the console of Chrome, neither a network one.
Could anybody point me to the right direction in order to debug and possibly solve this issue?