moralexluis

Query doesn't show results

Discussion created by moralexluis on Aug 27, 2010
Latest reply on Sep 1, 2010 by moralexluis
Hi, so this code was working for me like 2 weeks ago but... the map has change and then it doesn't work anymore, can you help me ? please

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>Query State Info without Map</title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css"/>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script>
    <script type="text/javascript" language="Javascript">
        dojo.require("esri.tasks.query");

        var queryTask, query;

        function init() {
            //build query
            queryTask = new esri.tasks.QueryTask("http://servarcgisprd/ArcGIS/rest/services/MapaBase/MapServer/4");
      
            //build query filter
            query = new esri.tasks.Query();
            query.returnGeometry = false;
            query.outFields = ["POSTE", "COORDENADA_X", "COORDENADA_Y"] 

        }

        function execute(stateName) {
            query.text = stateName;
            //execute query
            queryTask.execute(query, showResults);
        }

        function showResults(results) {
            var s = "";
            for (var i = 0, il = results.features.length; i < il; i++) {
                var featureAttributes = results.features[i].attributes;
                for (att in featureAttributes) {
                    s = s + "<b>" + att + ":</b>  " + featureAttributes[att] + "<br />";
                }
            }
            dojo.byId("info").innerHTML = s;
        }

        dojo.addOnLoad(init);
    </script>
  </head>
  <body>
    US state name : <input type="text" id="stateName" value="" />
    <input type="button" value="Get Details" onclick="execute(dojo.byId('stateName').value);" />
    <br />
    <br />
    <div id="info" style="padding:5px; margin:5px; background-color:#eee;">
    </div>
  </body>
</html> 


I think is the 'MapaBase' service the one who is making the mistake but... I don't know anymore
I'll appreciate if anyone can help me... :)

Outcomes