views:

62

answers:

0

Hi,

I'm trying to implement a JQuery autocomplete widget based on a php service I have built. Right now, for testing, the service is extremely simple and only returns an array of three names. While debugging with firebug, I'm noticing my service is returning a code 200, but there is no response text that comes along with it. Obviously, this is causing the widget to not function. This is a fairly simple problem(I think), but I cannot seem to get it to work. Here is the code for my service:

    <?php

$output = array();
$output[0] = "Alan";
$output[1] = "Alex";
$output[2] = "Ange";

print(json_encode($output));

?>

And here is the code/markup for my autocomplete:

    <html>
<head>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt;
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;

  <script>

 var url = "http://localhost/service.php";
  $(document).ready(function() {
    $("input#autocomplete").autocomplete({source: url});
  });
  </script>
</head>
<body style="font-size:62.5%;">

<input id="autocomplete" />

</body>
</html>

When I wget my service, I am getting a response.

In the error console through firefox, I am getting the message

Error: a is null

Source File: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js Line: 239

Any help would be appreciated.