map = new esri.Map("mapDiv", { center: [-95.80, 39.29], zoom: 4, basemap: "topo" });
When you say "add to map", is that map only for you displaying on your computer? Or, do you want to pass the URL of the web app so that you can share it?
In order to share your data or layer, you have to host it as a service either on your ArcGIS Server machine, or put it on arcgis.com.
dojo.require("esri.layers.KMLLayer"); var kmlUrl = "http://url-to-kml-file-here.kmz"; kml1 = new esri.layers.KMLLayer(kmlUrl); map.addLayer(kml1);
you can't add shapefiles. Otherwise few would pay for Server.
You have to either publish the data, or publish it on arcgis.com with an account and then consume the webmap in your application.
Limitations
Below are the limitations to using shapefiles in the ArcGIS.com map viewer.
Compression formats other than a .zip archive are not supported.
Files containing more than 1,000 features cannot be added to a map.
The following features are not supported: multipatch or multipoint geometries, geometries that cross the dateline, or self-intersections in polygons. Shapefiles with these features cannot be added to a map.