Jon
Jon

Reputation: 453

Why does this XQuery not return text using AJAX?

I'm expecting "hello world", but I'm getting blank or undefined from the AJAX response. I can see that I'm inside the test function if I use xdmp:log().

(: 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");

Upvotes: 0

Views: 107

Answers (1)

Jon
Jon

Reputation: 453

I had another function that was using the get request field to call the test function. The issue was that I didn't return anything in that function.

Upvotes: 1

Related Questions