how to refresh the particular part of the div or part of the web page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techuse
    New Member
    • May 2010
    • 19

    how to refresh the particular part of the div or part of the web page?

    i have the following code in ajax.can you help how to refresh the particular part of the div or part of the web page?
    here in this code the record is inserted but the div isnot get refreshed.


    Code:
    function getXmlHttpRequestObject()
    {
        if (window.XMLHttpRequest) {
            return new XMLHttpRequest();
        } else if(window.ActiveXObject) {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
        }
    }
    
    //Our XmlHttpRequest object to get the auto suggest
    var searchReq = getXmlHttpRequestObject();
    [B]//code for insert[/B]
    var nocache = 0;
    function insert(DivID,Idname,SeqNo,Status) {
        alert("Div ID :"+DivID)
        alert("IDName :"+Idname)
        alert("SeqNo  :"+SeqNo)
        alert("Status :"+Status)
    
    var DivID = DivID;
    var name  = Idname;
    var dip   = SeqNo;
    var sta   = Status;
    
    document.getElementById(DivID).innerHTML = "Just a second..."
    
    nocache = Math.random();
    alert("nocache="+nocache)
    
    searchReq.open('get', 'insert1.jsp?IDENTIFICATION_TYPE.DISPLAY_NAME='+name+'&IDENTIFICATION_TYPE.DISPLAYORDER=' +dip+'&IDENTIFICATION_TYPE.STATUS = '+sta+'&mode=insert');
    //searchReq.open("GET",''+Page+'?divIDName='+divID+'&accessMode='+mode+'&fieldID1='+fieldid1+'&fieldName1='+fieldname1+'&fieldName2='+fieldname2+'&filterValue='+filtervalue, true);
    
    searchReq.onreadystatechange = insertReply;
    searchReq.send(null);
    }
    
    function insertReply() {
    if(searchReq.readyState == 4){
    var response = searchReq.responseText;
    
    // else if login is ok show a message: "Site added+ site URL".
    document.getElementById(DivID).innerHTML = '<font color="#ccdb29">Added</font>'+response;
    alert("Response"+ responseText);
    document.getElementById(DivID).innerHTML = reload();
    }
    }
    Last edited by gits; May 14 '10, 09:18 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    does the alert occur? what does the reload()-method do?

    Comment

    • techuse
      New Member
      • May 2010
      • 19

      #3
      line 44 is working

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        so what is the problem then? whatfor is line 46 good? the alert should output: "Responseundefi ned" since responseText is undefined in your case ...

        Comment

        • techuse
          New Member
          • May 2010
          • 19

          #5
          where i have to cal the div refresh function.i searched many sites but i didnt get clear idea abt that function

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            you update the innerHTML with the responseText of the request ... what should happen next? ... the reload() method is basically used to reload a window's document (reload()) ... when you don't have a custom reload-method. why do you use it when you don't know what ist does - what purpose should it serve?

            Comment

            • techuse
              New Member
              • May 2010
              • 19

              #7
              can u tel me is there any other possible way to refresh a div part of page

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #8
                would you mind to answer any of the questions i asked before? the div's innerHTML is already modified with the responseText from the request ... what should happen instead when the current modification is not appropriate? ...

                Comment

                Working...