Autocomplete & remote data : works with local data... not remote

Autocomplete & remote data : works with local data... not remote

As explained here Plugins/Autocomplete, I did this example which works in my page / input:
now I can click on suggested results and go directly to the right url.
If I type 'L', 'Link A' & 'Link B' are suggested

--- with local data : js into my web page ---
var data = [ {text:'Link A', url:'/page1.html'}, {text:'Link B', url: '/page2.html'} ];
$("#valSearch").focus( function() {
        $(this).autocomplete(data, {
            formatItem: function(item) {
                 return item.text;
            }
        }).result(function(event, item) {
                 location.href = item.url;
        });
});
---

Now, I would like to put my data on a remote file

I replace :  $(this).autocomplete(data, {
by : $(this).autocomplete('search.php', {

And search.php is just
---
var data = [ {text:'Link A', url:'/page1.html'}, {text:'Link B', url: '/page2.html'} ];

OR

<?php
$q = strtolower($_GET["q"]);
if (!$q) return;
$items = array(
    'Link A' => '/page1.html',
    'Link B' => '/page2.html'
);

$result = array();
foreach ($items as $key=>$value) {
    if (strpos(strtolower($key), $q) !== false) {
        array_push($result, array(
            "text" => $key,
            "url" => $value
        ));
    }
}
echo json_encode($result);
?>
---

Both cases .... it doesn't works

I receive the json result & can show it with alert(), but no display &  'value is not defined' as consol message.

Without any php, I'd just like (by now) to do the same static exemple (working as above)... with remote data..

Any idea? ... Thank's if so ;-)