You need to set your proxy server in code a la:esri.config.defaults.io.proxyUrl = 'http://..../proxy.ashx';
If you don't have a proxy set up on your webserver, you need to add one. There are instructions here:https://developers.arcgis.com/javascript/jshelp/ags_proxy.html - this may take some trial and error on your part if you haven't set one up before. Google for help testing.This is pre-AMD code, but hopefully it helps - it won't tell you how to solve your proxy issues (which are essentially network related), but it is an example of dynamically pulling the options. There are two selections: export options (png, jpg, pdf, etc.) and layouts.Hopefully it helps.printRequest = esri.request({
url: "http://.../rest/services/Geoprocessing/WebMapPDF/GPServer/Export%20Web%20Map",
content: { f: "json" },
callbackParamName: "callback",
handleAs: "json"//,
});
printTypes = new Array();
layoutTypes = new Array();
printRequest.then(
function (response, input) {
// load printType list
//printTypes, layoutTypes
for (var i = 0; i < response.parameters[2].choiceList.length; i++) {
printTypes.push(
{
label: response.parameters[2].choiceList,
value: response.parameters[2].choiceList
});
}
// load printLayout list
for (var i = 0; i < response.parameters[3].choiceList.length - 1; i++) { // use length -1 to omit "MAP_ONLY" option
// Build normal name of print option
layoutName = response.parameters[3].choiceList;
layoutTypes.push({ label: layoutName, value: response.parameters[3].choiceList });
}
select = dojo.byId("printExportType");
if (dojo.byId("printButton") == undefined || dojo.byId("printButton") == null) {
select = new dijit.form.Select(
{
id: "printExportType",
//name: "printExportType",
options: printTypes,
value: printTypes[0].value,
onChange: function () {
printTemplate.format = dijit.byId("printExportType").get("value");
dojo.byId("printButton").textContent = "Generate " + dijit.byId("printExportType").get("value");
}
});
dojo.place(select.domNode, dojo.byId("toolInput"), "last");
// Create combo button to select template
select = new dijit.form.Select(
{
id: "printLayoutTemplate",
name: "printLayoutTemplate",
options: layoutTypes,
value: layoutTypes[1].value,
onChange: function () {
printTemplate.layout = dijit.byId("printLayoutTemplate").get("value");
}
});