Connecting Tech Pros Worldwide Help | Site Map

AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?

Mel
Guest
 
Posts: n/a
#1: Jun 22 '06
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

Dag Sunde
Guest
 
Posts: n/a
#2: Jun 22 '06

re: AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?


Mel wrote:[color=blue]
> 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
>[/color]
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;
....
}

--
Dag.


Mel
Guest
 
Posts: n/a
#3: Jun 22 '06

re: AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?



Dag Sunde wrote:[color=blue]
> Mel wrote:[color=green]
> > 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
> >[/color]
> 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;
> ...
> }[/color]


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 ?

[color=blue]
>
> --
> Dag.[/color]

Ian Skinner
Guest
 
Posts: n/a
#4: Jun 22 '06

re: AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?


Mel wrote:[color=blue]
> Dag Sunde wrote:[color=green]
>> Mel wrote:[color=darkred]
>>> 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
>>>[/color]
>> 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;
>> ...
>> }[/color]
>
>
> 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 ?
>
>[color=green]
>> --
>> Dag.[/color]
>[/color]

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.
Closed Thread


Similar JavaScript / Ajax / DHTML bytes