2017-07-17 31 views
0

我在期待「hello world」,但我從AJAX響應中變得空白或未定義。如果我使用xdmp:log(),我可以看到我在測試函數中。爲什麼這個XQuery不能使用AJAX返回文本?

(: test.xqy there is a get request field that calls the test function 
    based on the test parameter from url :) 

declare function local:test(){ 
    let $hello := "hello world" 
    return $hello 
} 

// ajax from js file 
$j.get("/search/survey.html?test", null, function(res){ 
    console.log("res:"); 
    console.log(res); // blank 
    console.log(res.responseText); // undefined 
}, "text"); 

回答

1

我有另一個函數使用get request字段來調用測試函數。問題是我沒有在該功能中返回任何東西。

相關問題