jQuery autocomplete

jQuery autocomplete

Hi,

I'm using jQuery 1.3.2 and jQuery UI 1.8.10. I want to try autocomplete, but this far I only succeeded with local data. When I tried to use PHP as source, I failed to get any result. The php code receives the typed text in $_GET["term"], but the returned JSON data is not displayed.
The code looks like this:
  1. <head>
  2. ...
  3. <script type="text/javascript"> 
  4. jQuery(document).ready(function(){
  5. var data = ["alpha", "auto", "auto1", "auto2", "auto3", "beta"]; //this worked
  6. jQuery("#city_id").autocomplete({
  7. source: "city_cpl.php",
  8. dataType: "jsonp",
  9. minLength: 1,
  10. });
  11. });
  12. </script> 
  13. </head>
  14. <body>
  15. ...
  16. <input type="text" name="city" id="city_id" autocomplete="off"/>
  17. ...
  18. </body>

The main part of the PHP code is:
  1. // I also tried this
  2. // $arr = array("aaa", "aaa2", "aaa3");
  3. $arr = array(array('label' => "aaa", 'value'=> "aaa2"), 
  4. array('label' => "aaa3", 'value'=> "aaa4"), 
  5. );
  6. echo json_encode($arr);
The PHP seems to be working fine ($_GET["term"] is defined, its value is what I type in), the output of PHP is  [{"label":"aaa","value":"aaa2"},{"label":"aaa4","value":"aaa3"}] as expected. But the search hint box does not appear. What did I do wrong?

Thanks in advance,
Visko