AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?

M

Mel

Is there a way of restricting operations such as links, buttons etc. to
within the <DIV> only ?

Let me clarify the problem a little.

I am doing an AJAX like operation inside a DIV. I do a server trip
without refreshing the page and get new HTML code that includes links
forms etc back from server. I need to confine operations within this
DIV without refreshing the whole page without using IFRAME.

Am i asking the right question or is there a known solution to such
problems


thanks for your help
 
D

Dag Sunde

Mel said:
Is there a way of restricting operations such as links, buttons etc.
to within the <DIV> only ?

Let me clarify the problem a little.

I am doing an AJAX like operation inside a DIV. I do a server trip
without refreshing the page and get new HTML code that includes links
forms etc back from server. I need to confine operations within this
DIV without refreshing the whole page without using IFRAME.

Am i asking the right question or is there a known solution to such
problems
Your question is a little bit confusing...

Are you asking if it is possible to use your AJAX response-data
to update only the content of a specific div element, and not the
whole page?

If so, the answer is yes.

If your AJAX call ie. return some html-fragment, and you want a
specific div element to be updated to show this, do something like this

<div id="updateDiv">
....
</div>

....

function ajaxResponse() {
....

var updtDiv = document.getElementById("updateDiv");
updtDiv .innerHTML = xmlHttpObj.responseText;
....
}
 
M

Mel

Dag said:
Your question is a little bit confusing...

Are you asking if it is possible to use your AJAX response-data
to update only the content of a specific div element, and not the
whole page?

If so, the answer is yes.

If your AJAX call ie. return some html-fragment, and you want a
specific div element to be updated to show this, do something like this

<div id="updateDiv">
...
</div>

...

function ajaxResponse() {
...

var updtDiv = document.getElementById("updateDiv");
updtDiv .innerHTML = xmlHttpObj.responseText;
...
}


Well Yes and NO !

I have already displayed the result of my server response in the DIV
(which i think is what you showed me). The question is, if the returned
HTML within this DIV has links and the user clicks on them, can i
display the result within this DIV itself and not a refresh on the
whole page ?
 
I

Ian Skinner

Mel said:
Well Yes and NO !

I have already displayed the result of my server response in the DIV
(which i think is what you showed me). The question is, if the returned
HTML within this DIV has links and the user clicks on them, can i
display the result within this DIV itself and not a refresh on the
whole page ?

Yes, you can, but not automatically or simply. You would have to do
something that would modify the link action|event|behavior so that you
can capture it and control it to get the results and display back to the
div. Not a simple task if you ask me.
 

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,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top