Hi Miguel,
I think you can add an to the jquery ajax call to let jquery itself handle
the jsonp stuff. The option is:
jsonp: 'parseResponse'
Then your success function should be called upon Geoserver response.
Mauro
2013/10/25 Miguel-Angel Manso-Callejo (UPM) <[email protected]>
> 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
>
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
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