esri和Python之间的连接错误

时间:2015-01-15 22:49:24

标签: javascript esri

我正在尝试使用Javascript的Python文件,我正在使用Esri库。我写了下面的代码,但它一直给我错误。

var myObj //defined as a string which is passed to 
require(["esri/request"], function(esriRequest){
  var dd=esriRequest{
   content: {myObj},
   handleAs: "json",
   url: "www.example.com/pythonFile.py"
 }
}

我将不胜感激任何帮助

1 个答案:

答案 0 :(得分:1)

如果token需要身份验证,我认为您可能会错过在esriRequest变量的内容中传递example.com。在这种情况下,正确的答案是:

token = "" //a string which gives you the permission to visit example.com you can take it after giving credentials to the mapserver or website
var myObj //defined as a string which is passed to 
require(["esri/request"], function(esriRequest){
  var dd=esriRequest{
   content: {"SP": myObj, token: token},
   handleAs: "json",
   url: "www.example.com/pythonFile.py"
 }
}