AJAXing newbeee question. POSSIBLE or IMPOSSIBLE ?

Discussion in 'Javascript' started by Mel, Jun 22, 2006.

  1. Mel

    Mel Guest

    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
    Mel, Jun 22, 2006
    #1
    1. Advertising

  2. Mel

    Dag Sunde Guest

    Mel wrote:
    > 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;
    ....
    }

    --
    Dag.
    Dag Sunde, Jun 22, 2006
    #2
    1. Advertising

  3. Mel

    Mel Guest

    Dag Sunde wrote:
    > Mel wrote:
    > > 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;
    > ...
    > }



    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 ?


    >
    > --
    > Dag.
    Mel, Jun 22, 2006
    #3
  4. Mel

    Ian Skinner Guest

    Mel wrote:
    > Dag Sunde wrote:
    >> Mel wrote:
    >>> 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;
    >> ...
    >> }

    >
    >
    > 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 ?
    >
    >
    >> --
    >> Dag.

    >


    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.
    Ian Skinner, Jun 22, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Spiewak
    Replies:
    1
    Views:
    416
    Rick Spiewak
    Jul 22, 2003
  2. =?Utf-8?B?VVJHRU5ULi5QbGVhc2U=?=

    IMPOSSIBLE QUESTION

    =?Utf-8?B?VVJHRU5ULi5QbGVhc2U=?=, Sep 4, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    590
    Greg Burns
    Sep 4, 2004
  3. shane

    Impossible question?

    shane, Oct 5, 2010, in forum: C Programming
    Replies:
    71
    Views:
    1,665
  4. Nathan

    newbeee

    Nathan, Dec 30, 2003, in forum: ASP General
    Replies:
    5
    Views:
    103
    Guest
    Dec 30, 2003
  5. Replies:
    5
    Views:
    249
    Michele Dondi
    Jun 30, 2006
Loading...

Share This Page