Re: Can you parse JSON with the eXist database?

Ted Hickox <[email protected]> Mon, 19 Aug 2024 14:05:13 -0500
Newsgroups gmane.text.xml.exist
Message-ID <CAAsp6CZMKamxdosv1sK9-B8+t8bvgFgv0j-sLYDHGC9-osKfwQ@mail.gmail.com>
Okay, I was stupid and forgot to add the send command.  But this still
didn't fix the problem.  Here is my adjusted code:

function Setup() {
    var XMLHttp;
    var JSON_Data;

    XMLHttp = new XMLHttpRequest();
    XMLHttp.open("GET", "
http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json", true);
        XMLHttp.onReadyStateChange = function(){

            document.getElementById("JSON_Text").value = "I'm right here.";

        };
XMLHttp.send();}

Unless I reposition my document.getElementById command, nothing will appear
in my textbox.

On Mon, Aug 19, 2024 at 1:23 PM Florian Schmitt <
[email protected]> wrote:

> Ted, as far as I see, you never send() your request. The open() method
> specifies / initializes the request, but it doesn't send/execute it.
> See:
> https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open
> https://www.w3schools.com/xml/ajax_xmlhttprequest_create.asp
>
> HTH
> Florian
>
>
> Am 19.08.24 um 19:52 schrieb Ted Hickox:
> > I keep hitting a stone wall.  If I write my code like this:
> >
> > function Setup() {
> >      var XMLHttp;
> >      var JSON_Data;
> >
> >      XMLHttp = new XMLHttpRequest();
> >      XMLHttp.open("GET",
> > "http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json
> > <http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json>",
> > true);
> >
> >
> >              document.getElementById("JSON_Text").value = "I'm right
> > here.";
> >
> > }
> > The words I'm right here appear in the textbox.
> >
> > But if I write my code like this:
> >
> > function Setup() {
> >      var XMLHttp;
> >      var JSON_Data;
> >
> >      XMLHttp = new XMLHttpRequest();
> >      XMLHttp.open("GET",
> > "http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json
> > <http://localhost:8080/exist/rest/db/apps/HTML_Student/people.json>",
> > true);
> >      XMLHttp.onReadyStateChange = function(){
> >
> >              document.getElementById("JSON_Text").value = "I'm right
> > here.";
> >      };
> > }
> >
> > Nothing appears in my textbox.  And I don't understand why.  Can
> > someone please explain this to me?
>
>
>
> _______________________________________________
> Exist-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open