XMLHttpRequest

H

Haris

Hi.

How should the simplest XMLHttpRequest look like ?
I create XMLHttpRequest object:
var xhr=new XMLHttpRequest();
// then the open mathod
xhr.open ("GET", "something.xml");
// send
xhr.send (null);
// and
xhr.onreadystatechange=function a { ... }

The function "a" is a callback I guess, but how to
get a response from the server in that callback ?
I use Lisp server Hunchentoot, and where to enter a Lisp code
to interact with the server ?
 
L

Luuk

Hi.

How should the simplest XMLHttpRequest look like ?
I create XMLHttpRequest object:
var xhr=new XMLHttpRequest();
// then the open mathod
xhr.open ("GET", "something.xml");
// send
xhr.send (null);
// and
xhr.onreadystatechange=function a { ... }

The function "a" is a callback I guess, but how to get a response from
the server in that callback ?
I use Lisp server Hunchentoot, and where to enter a Lisp code
to interact with the server ?

comp.lang.lisp ?
 
T

Thomas 'PointedEars' Lahn

Haris said:
How should the simplest XMLHttpRequest look like ?
I create XMLHttpRequest object:
var xhr=new XMLHttpRequest();
// then the open mathod
xhr.open ("GET", "something.xml");
// send
xhr.send (null);
// and
xhr.onreadystatechange=function a { ... }

The function "a" is a callback I guess,

It is (when syntactically correct written). That aside, you see where you
went wrong, don't you?
but how to get a response from the server in that callback ?

xhr.responseText or xhr.responseXML. RTFM.
I use Lisp server Hunchentoot, and where to enter a Lisp code
to interact with the server ?

Again, RTFM¹. You would use Lisp code at the server, and ECMAScript-based
code at the client. (I have yet to see a client-side Lisp script engine in
a Web browser.)

_______
¹ e.g., … err, Google is your friend. [psf 6.1]


PointedEars
 
T

Tim Streater

Haris said:
Hi.

How should the simplest XMLHttpRequest look like ?
I create XMLHttpRequest object:
var xhr=new XMLHttpRequest();
// then the open mathod
xhr.open ("GET", "something.xml");
// send
xhr.send (null);
// and
xhr.onreadystatechange=function a { ... }

The function "a" is a callback I guess, but how to
get a response from the server in that callback ?
I use Lisp server Hunchentoot, and where to enter a Lisp code
to interact with the server ?

Look here for a simple example:

http://www.clothears.org.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top