我正在尝试使用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"
}
}
我将不胜感激任何帮助
答案 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"
}
}