Javascript debug problem

486
1
09-18-2013 08:42 AM
sailiTang
New Contributor III
Hi,

I am using ArcGIS api for javascript. I have a javascript function

<script type="text/javascript" src="http://js.arcgis.com/3.6/"></script>
                   <script type="text/javascript">

                       function DisplayMap(strPoints, strfirestat) {

                           var map;
                           var i;
                           //var regions;

                           require([
                                   
                                    "esri/map", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/graphic", "esri/tasks/GeometryService", "esri/graphicsUtils", "dojo/domReady!"
                            ], function (
                                          
                                    Map, Point, SimpleMarkerSymbol, Graphic, GeometryService, graphicsUtils

){
                            });
                       }
</script>

My vb.net code is:
jvscript = "DisplayMap('" & str & "', '" & firestr & "');"
Page.ClientScript.RegisterStartupScript(Me.GetType, "TimeOutMessage", jvscript, True)

Once I add "esri/graphicsUtils" and graphicsUtils, I always get the error message:"JavaScript runtime error: 'DisplayMap' is undefined". But if I delete them, the code works. Do you have any idea about it? I need graphicsUtils to get selected polygon???s center: var center = graphicsUtils.graphicsExtent(selection).getCenter(); Could you tell me what the problem of my above code is? Thanks.

Saili
0 Kudos
1 Reply
JonathanUihlein
Esri Regular Contributor
Have you tried moving your require block to outside a function (on the script level) and writing functions within the require block?
0 Kudos