I get an error the first time I execute a print task on a page. This is error I get..."RequestError: Unable to Load /proxy/...<print task url>/execute status: 404." Despite getting error the first time I execute task, it works flawlessly after that. Am I missing something?
Here is code...
$("#btnPrintDefault").on("click", function () {
printUrl = "http://gisfarm.spokanecounty.org/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
var printTask = new PrintTask(printUrl);
var template = new PrintTemplate();
var legendLayer = new esri.tasks.LegendLayer();
legendLayer.layerId = "roadLayer";
legendLayer.subLayerIds = [58, 117];
template.format = "PDF";
template.layout = "Letter ANSI A Landscape";
template.layoutOptions = {
"titleText": "Spokane County",
"scalebarUnit": "Miles",
"legendLayers": [legendLayer]
};
template.preserveScale = true;
var params = new PrintParameters();
params.map = map;
params.template = template;
$('#mapPage').css("cursor", "progress");
printTask.execute(params, getPrinted, getPrintError);
});