Mindie,
I prefer to put javascript in a .js file, but escaping curly braces
ought to work. Can you be more specific about the escaping you used, and
the resulting errors? The problem might have been a simple typo.
I think your original code relies on jQuery, and I didn't know exactly
what to set up around it. But here's a test case that works for me:
xdmp:set-response-content-type('application/xhtml+xml'),
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<script type="text/javascript">
// this should be in the head
var foo = function() {{ alert('test') }};
foo();
</script>
</head>
<body>
<p>hello world</p>
</body>
</html>
If I place this query in 'test.xqy' in my HTTPServer root, I can visit
the page with firefox 3. I see the alert, and after I dismiss it, the
page body renders.
-- Mike
Mindie Sorenson wrote:
I have the following script in the <head> tag of my .xqy page:
<script type="text/javascript">
// this should be in the head
$(function(){
$("#suggest2").autocomplete("test.xqy", {
delay: 200,
width: 260,
selectFirst: false
});
})
</script>
However, this code breaks the .xqy page. I have verified that this code works
great in a standard html file, but as soon as I move it to my .xqy page, it
causes errors. I have tried adding extra curly braces in an attempt to escape
them, and the page will then render, but the javascript isn't evaluated
correctly.
Does anyone know a 'trick' for using javascript like this in .xqy files?
Thanks
Mindie
----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies of
the original message.
------------------------------------------------------------------------
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general