Dear,

I'm trying to use JQuery autocomplete showing json data retrieved from a 
GetFeature request to a Geoserver,
but i have problems.

I have set ENABLE_JSONP system variable to true.

This is my code:

     <input id="input" name="muni_name" type="text" style="width: 200px;">
     <input id="muni-input" name="muni_code" type="text" 
style="width:100px;" readonly>

<script type='text/javascript'>

$(function () {
     $("#input").autocomplete({
         source: function (request, response) {
             $.ajax({
                 url: "http://localhost:8080/geoserver/ows";,
                 dataType: "jsonp",
                 data: {
                     typename: "municipios",
                     propertyName: "municipio,codigo",
                     outputformat: "text/javascript",
                     service: "wfs",
                     version: "1.0.0",
                     request: "GetFeature",
                     cql_filter: "municipio ILIKE '" + request.term + "%'"
                 },
                 success: function () {
                     response($.map(data.features, function (item) {
                         alert( item);
                         return {
                             // following property gets displayed in 
drop down
                             label: item.id,
                             // following property gets entered in the 
textbox
                             value: item.id,
                             // following property is added for our own use
                             code: item.codigo
                         }
                     }));
                 }
             });
         },
         minLength: 5,
         select: function (event, ui) {
             if (ui.item) {
                 $("#muni-input").val(ui.item.code);
             }
         }
     });
});
</script>


The problem, there are not a callback function parseResponse (default 
callback funtion of geoserver).

How can i do to solve this?
Define a parseResponse() function out of $() function, and how to link 
results to success event of Jquery ui?

Regards,
Miguel A. Manso

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to