通过JavaScript通过XML URL运行FM脚本



我正在开发一个自定义JS Web地图,该映射应该根据用户在地图上单击的位置在我们的服务器上执行Filemaker脚本。使用特定于Filemaker的语法中的XML URL从Web调用脚本。执行脚本时,无需返回数据。

我已经成功编写了JS,该JS在用户单击地图上时执行。我也知道XML URL是正确的,因为当我在浏览器中输入它时,脚本会在服务器上触发。

但是,当我尝试获取点击事件以发送XML请求时,什么也不会发生。我是XML的新手,所以我认为这与我称为XML URL的方式有关。我的网络地图与Filemaker在同一服务器上。

这是我到目前为止的JS。现在,我只是想让它执行测试脚本。最终,我将将变量Segid传递到Filemaker脚本中:

// Watch for pop-up event
view.popup.watch("selectedFeature", function(event) {
    // if pop-up returns a feature... (to avoid error if user clicks too far from segment)
    if (event && event.attributes && event.attributes.CIRCUIT_ID) {
    // set segId equal to value of CIRCUIT_ID
     var segId = event.attributes.CIRCUIT_ID;
    // render a style change to the selected feature (functiondefined below)
    featureLayer.renderer = generateRenderer(segId);
function sendSegId() {
    console.log("XML request sent");        
    var xhttp = new XMLHttpRequest();
    xhttp.open("GET", "http://Admin@206.123.249.187/fmi/xml/fmresultset.xml?-db=WebViewerTest&-lay=Maps&-script=test&-script.param=88&-findall", true);
    xhttp.send();
    console.log("XML request executed" + segId);    
}
    sendSegId();
}
});

确保所有脚本步骤均与您正在运行的FileMaker脚本兼容,并确保管理员用户有特权执行脚本。

尝试

http://206.123.249.187/fmi/xml/fmresultset.xml?db=webviewertest& lay = maps&amps; script = test

这将返回错误4,表明有一个不兼容的步骤之一。

从测试脚本中删除所有脚本步骤,仅留下一个步骤,例如提交记录,然后运行脚本。

另一个问题可能是,如果您在打开数据库时触发的脚本中有不兼容的脚本步骤。

最新更新