我正在尝试将Python文件转换为Javascript,并且正在使用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"
}
}
我将不胜感激任何帮助
最佳答案
我认为如果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"
}
}