Upload point data onto webmap, or add data to a Feature service via JS code. Dynamic

Discussion created by damienb29 on Jun 11, 2013
I want to create a web-app and I have some basic questions on my understand that I would like to get clarity on before I progress.
I want to create a web-app,

   I want the user able to able to change from a basemap layer(i.e. from Streets, or topo) to a webmap of there choice using the webmap hash id on a text input submit form. Is it possible to change between different base layer maps and random public web-map dynamically. ? I think I have come across an example but I am not sure.

Is it possible to display point data from my own server in esri friendly json format and a public webmap? or can I pull data from a web service to display on any available webmap? Or does any data being display on a webmap have to be saved on the webmap before it is saved as such.

Essentially can I add data dynamically through Javascript code to a feature service(feature.Layer) or to a webmap

var templateMap = "webmap hash"
        var mapDeferred = esri.arcgis.utils.createMap(templateMap, "map");
  mapDeferred.then(function(response) {
          dojo.byId("title").innerHTML = response.itemInfo.item.title;
          dojo.byId("subtitle").innerHTML = response.itemInfo.item.snippet;
          map = response.map;

//Graphics to add to webmap
var featureLayer = new esri.layers.FeatureLayer(featureCollection, {
  mode: esri.layers.FeatureLayer.MODE_ONDEMAND

// or try add data from feature service to webmap

var testFS = new esri.layers.FeatureLayer("http://services.arcgis.com/examplefeatureservice/FeatureServer/0", {
  mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
  infoTemplate: popupTemplate,
          outFields: ["url","lat", "long"]

var basicSymbol = new esri.symbol.SimpleMarkerSymbol("circle", 5, null, new dojo.Color("black"));
  var renderer = new esri.renderer.SimpleRenderer(basicSymbol);

//finally, add the whole layer containing everything to the map

This doesnt work, I am going about this the wrong way or is it even possible??