Issue loading layers from Arc Server

Discussion created by bullish79 on Jan 24, 2014
New esri developer. I'm trying to load a layer from arc server but I'm getting this error in console window of developer tools for chrome.
Resource interpreted as Script but transferred with MIME type text/plain: "https://waxhawarcgis.waxhaw.com/arcgis/rest/services/EnerGov/EnerGovMap/MapServer/22?f=json&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback".

Here is how I'm creating the map and setting the layer

var LAYERS_SERVER = [{ url: 'https://waxhawarcgis.waxhaw.com/arcgis/rest/services/EnerGov/EnerGovMap/MapServer/22', name: 'Flex Utility' }];

var createServerMap = function () {
        var initialZoomLevel = 3;

        map = new esri.Map("map", {
            zoom: initialZoomLevel,
            slider: false,
            wrapAround180: true,
            showAttribution: true,

        map.on('layer-add-result', function (layer, error) {
            if (layer.layer.id == LAYERS_SERVER[0].name)
                map.setExtent(new esri.geometry.Extent(layer.layer.fullExtent.xmin, layer.layer.fullExtent.ymin, layer.layer.fullExtent.xmax, layer.layer.fullExtent.ymax,
                    new esri.SpatialReference({ wkid: map.extent.spatialReference.wkid })));

        addLayers(map, LAYERS_SERVER);

var addLayers = function(map, layers) {
        var template = new esri.InfoTemplate();
        // If a feature layer is setup in system but not in Webmap, add them to the map
        $.each(layers, function (i, val) {
            var gisServerLayer = new esri.layers.FeatureLayer(val.url, {
                mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
                outFields: ["*"],
                id: val.name,
                displayOnPan: true,
                visible: true,
                infoTemplate: template

Any help in resolving this would be greatly appreciated. Or if you can point me in the right direction.