XMLHttpRequest and new frame?

G

Geoff Cox

Hello,

I am trying to get XMLHttpRequest etc to send a javascript variable to
a php file which will search a MySQL database but I want the results
to appear in a different frame.

How can I do this?!

Using a different approach I can get this to work.

window.parent.frameright.location.href = etc

where the different frame is called frameright.

I need an equivalent method with

function startRequest(url) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

In other words how do I get frameright as the target for the above
url?

Ideas please?

Cheers

Geoff
 
T

Tom Cole

Hello,

I am trying to get XMLHttpRequest etc to send a javascript variable to
a php file which will search a MySQL database but I want the results
to appear in a different frame.

How can I do this?!

Using a different approach I can get this to work.

window.parent.frameright.location.href = etc

where the different frame is called frameright.

I need an equivalent method with

function startRequest(url) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

In other words how do I get frameright as the target for the above
url?

Ideas please?

Cheers

Geoff

Why not just have your handleStateChange function (in the same frame)
receive the value and then send the value to your other frame? AFAIK
there is no "target" value on xmlhttprequests.
 
G

Geoff Cox

Why not just have your handleStateChange function (in the same frame)
receive the value and then send the value to your other frame? AFAIK
there is no "target" value on xmlhttprequests.

OK - how do you send the value to the other frame?

Cheers

Geoff
 
T

Tom Cole

OK - how do you send the value to the other frame?

Cheers

Geoff

You access other frames through their names.

If the frame you want to pass the value to is in the same frameset,
then you can call parent.<other_frames_name>.method(value) to pass
that value to the "method" in the "other_frame_name".

If it is in another frameset, you can use top to get to the top of the
frame tree.

HTH.
 
A

ASM

Geoff Cox a écrit :
Hello,

I am trying to get XMLHttpRequest etc to send a javascript variable to
a php file which will search a MySQL database but I want the results
to appear in a different frame.

why would you have to use XHR to send result from a form to a frame ?

Basic JS does it very well

<form action="searchSQL.php" target="myFrame" method=post>
 

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

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top