jquery script only partly working

Monday, 5 November 2012 · 3 messages · last reply 6 Nov 2012
AH
Alexander Holupirekin reply to France Baril, 5 Nov 2012, 23:265 Nov 2012 22:39 #
Quoted text · France Baril · 46 lines
On 05.11.2012, at 22:26, France Baril wrote: > Hi, > > I am displaying html from transformed content. > > module namespace jq = "http://www.architextus.com/xquery/library/how2_jquery"; > declare namespace rest="http://exquery.org/ns/restxq"; > > > declare %rest:path("/testjquery") > %rest:GET > function jq:test() as node(){ > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <title>Testing JQuery</title> > <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> > </head> > <body> > <div> > <p><input id="helpful-yes4" name="helpful" type="radio"></input><span>Yes</span> > <input id="helpful-no4" name="helpful" type="radio"></input><span>No</span></p> > <p>Here is a paragraph</p> > <div id="t1">Test redirectire.</div> > <script type="text/javascript"> > > $("#helpful-no4").click(function ( event ) &#123; > $("#t1").show();&#125;); > > $("#helpful-yes4").click(function ( event ) &#123; > $("#t1").hide();&#125;); > > </script> > </div> > </body> > </html> > > return $html > }; > > I access content with: http://localhost:8984/restxq/testjquery > > The jquery does not work. If I save the result with a right-click in the browser, it saves as .xml. Jquery doesn't work either. > If I rename the saved file .html. It works. Is there anything I can do for the browser to think what it gets is .html when displaying dynamic content? > > Note: My html is not as simple as the one above. It is generated from an .xsl that actually says <xsl:output method="html"/>. The result however is the same.
Hi France, can you post your Request/Response Headers? Have tried playing with things, like %output:method("html") as described in [1]. Thanks, Alex [1] http://docs.basex.org/wiki/RESTXQ#Output
FB
France Baril5 Nov 2012 23:26 #
Hi, I am displaying html from transformed content.
*module namespace **jq* = "
http://www.architextus.com/xquery/library/how2_jquery";
*declare namespace **rest*="http://exquery.org/ns/restxq";
*declare* %rest:path("/testjquery") %rest:GET *function* *jq:test*() *as **node*(){
   *let **$html* := <html *xmlns*=*"http://www.w3.org/1999/xhtml"*>
    <head>
        <title>Testing JQuery</title>
        <script *src*=*"http://code.jquery.com/jquery-latest.js"* *type*=*
"text/javascript"*></script>
    </head>
    <body>
    <div>
        <p><input *id*=*"helpful-yes4"* *name*=*"helpful"* *type*=*"radio"*
Quoted text · 1 line
></input><span>Yes</span>
        <input *id*=*"helpful-no4"* *name*=*"helpful"* *type*=*"radio"*
Quoted text · 1 line
></input><span>No</span></p>
        <p>Here is a paragraph</p>
        <div *id*=*"t1"*>Test redirectire.</div>
        <script *type*=*"text/javascript"*>

         $("#helpful-no4").click(function ( event ) &#123;
         $("#t1").show();&#125;);

         $("#helpful-yes4").click(function ( event ) &#123;
         $("#t1").hide();&#125;);

</script>
    </div>
    </body>
</html>

*return **$html*
   };
I access content with: http://localhost:8984/restxq/testjquery The jquery does not work. If I save the result with a right-click in the browser, it saves as .xml. Jquery doesn't work either. If I rename the saved file .html. It works. Is there anything I can do for the browser to think what it gets is .html when displaying dynamic content? Note: My html is not as simple as the one above. It is generated from an .xsl that actually says <xsl:output method="html"/>. The result however is the same.
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
FB
France Barilin reply to Alexander Holupirek, 5 Nov 2012, 22:396 Nov 2012 04:44 #
Yes! Noted, declaring xsl:output in the .xsl transform that creates the $html doesn't make it go through the .xqm layer. It all works now and it will help with another similar issue I've been carrying around. Big thanks! France
Quoted text · Alexander Holupirek · 69 lines
On Mon, Nov 5, 2012 at 4:39 PM, Alexander Holupirek < alexander.holupirek at uni-konstanz.de> wrote: > On 05.11.2012, at 22:26, France Baril wrote: > > > Hi, > > > > I am displaying html from transformed content. > > > > module namespace jq = " > http://www.architextus.com/xquery/library/how2_jquery"; > > declare namespace rest="http://exquery.org/ns/restxq"; > > > > > > declare %rest:path("/testjquery") > > %rest:GET > > function jq:test() as node(){ > > > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > > <title>Testing JQuery</title> > > <script src="http://code.jquery.com/jquery-latest.js" > type="text/javascript"></script> > > </head> > > <body> > > <div> > > <p><input id="helpful-yes4" name="helpful" > type="radio"></input><span>Yes</span> > > <input id="helpful-no4" name="helpful" > type="radio"></input><span>No</span></p> > > <p>Here is a paragraph</p> > > <div id="t1">Test redirectire.</div> > > <script type="text/javascript"> > > > > $("#helpful-no4").click(function ( event ) &#123; > > $("#t1").show();&#125;); > > > > $("#helpful-yes4").click(function ( event ) &#123; > > $("#t1").hide();&#125;); > > > > </script> > > </div> > > </body> > > </html> > > > > return $html > > }; > > > > I access content with: http://localhost:8984/restxq/testjquery > > > > The jquery does not work. If I save the result with a right-click in the > browser, it saves as .xml. Jquery doesn't work either. > > If I rename the saved file .html. It works. Is there anything I can do > for the browser to think what it gets is .html when displaying dynamic > content? > > > > Note: My html is not as simple as the one above. It is generated from an > .xsl that actually says <xsl:output method="html"/>. The result however is > the same. > > Hi France, > > can you post your Request/Response Headers? > Have tried playing with things, like %output:method("html") as described > in [1]. > > Thanks, > Alex > > [1] http://docs.basex.org/wiki/RESTXQ#Output
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341

⚡Generated with XQuery