I am trying a Python file to Javascript and I am using Esri library. I wrote the following code but it keeps giving me error.
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"
}
}
I would appreciate any help
I think you might miss passing the token
in the content of esriRequest
variable if example.com
needs authentication. In that case, the correct answer would be:
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"
}
}