Hi Yoann,
we had written an example about two years ago when we were using
Openlaszlo (RIP) as GUI tool so my example is in the framework's code.
I think it is rather understandable and easily portable to JQuery or any
othe AJAX tk.
Following the method for building and sending the request in our OL AJAX
class. It sets the src (URI) of the request, the content (with
corresponding XML mime type header) taken from a OL dataset and the adds
an Authorzation header to the request. The authorization is Basic and is
retrieved from a "connectform" widget where the user inserts its
credentials.
<method name="sendRequest" args="uri, xmldata">
this.setAttribute("src", connectform.getURL())
this.setHeader("Authorization", connectform.getAuth())
if(xmldata != null){
this.setHeader("Content-Type", "application/xml");
this.setAttribute('postbody', xmldata);
}
this.doAJAXRequest()
</method>
This is the connectform.getAuth() method that builds the content of the
Basic Authentication Header.
<method name="getAuth">
return "Basic " + b64.encode(this.userfield.getText() + ":"
+ this.passwordfield.getText())
</method>
Hope this helps.
Regards,
Marco.
On 05/07/2014 01:38 AM, Yoann Maingon wrote:
Hi,
After xmlprague and my presentation at the BaseX user group I was told
(and I agree) that it wasn't really smart to use php for what I was
building as it had almost no added value as I could directly query
basex using the Rest Interface.
Does anyone as some example using either angularjs or jquery ? I think
I'm struggling with the login. Even just trying with a Rest test tool,
I can see that I have error messages in Basex telling me theat access
was refused.
Yoann Maingon
CEO - mydatalinx
+33664324966