473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

19
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.


Expand|Select|Wrap|Line Numbers
  1. function getXmlHttpRequestObject()
  2. {
  3.     if (window.XMLHttpRequest) {
  4.         return new XMLHttpRequest();
  5.     } else if(window.ActiveXObject) {
  6.         return new ActiveXObject("Microsoft.XMLHTTP");
  7.     } else {
  8.         alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
  9.     }
  10. }
  11.  
  12. //Our XmlHttpRequest object to get the auto suggest
  13. var searchReq = getXmlHttpRequestObject();
  14. //code for insert
  15. var nocache = 0;
  16. function insert(DivID,Idname,SeqNo,Status) {
  17.     alert("Div ID :"+DivID)
  18.     alert("IDName :"+Idname)
  19.     alert("SeqNo  :"+SeqNo)
  20.     alert("Status :"+Status)
  21.  
  22. var DivID = DivID;
  23. var name  = Idname;
  24. var dip   = SeqNo;
  25. var sta   = Status;
  26.  
  27. document.getElementById(DivID).innerHTML = "Just a second..."
  28.  
  29. nocache = Math.random();
  30. alert("nocache="+nocache)
  31.  
  32. searchReq.open('get', 'insert1.jsp?IDENTIFICATION_TYPE.DISPLAY_NAME='+name+'&IDENTIFICATION_TYPE.DISPLAYORDER=' +dip+'&IDENTIFICATION_TYPE.STATUS = '+sta+'&mode=insert');
  33. //searchReq.open("GET",''+Page+'?divIDName='+divID+'&accessMode='+mode+'&fieldID1='+fieldid1+'&fieldName1='+fieldname1+'&fieldName2='+fieldname2+'&filterValue='+filtervalue, true);
  34.  
  35. searchReq.onreadystatechange = insertReply;
  36. searchReq.send(null);
  37. }
  38.  
  39. function insertReply() {
  40. if(searchReq.readyState == 4){
  41. var response = searchReq.responseText;
  42.  
  43. // else if login is ok show a message: "Site added+ site URL".
  44. document.getElementById(DivID).innerHTML = '<font color="#ccdb29">Added</font>'+response;
  45. alert("Response"+ responseText);
  46. document.getElementById(DivID).innerHTML = reload();
  47. }
  48. }
May 14 '10 #1

✓ answered by gits

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?

7 4585
gits
5,390 Expert Mod 4TB
does the alert occur? what does the reload()-method do?
May 14 '10 #2
techuse
19
line 44 is working
May 14 '10 #3
gits
5,390 Expert Mod 4TB
so what is the problem then? whatfor is line 46 good? the alert should output: "Responseundefined" since responseText is undefined in your case ...
May 14 '10 #4
techuse
19
where i have to cal the div refresh function.i searched many sites but i didnt get clear idea abt that function
May 14 '10 #5
gits
5,390 Expert Mod 4TB
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?
May 14 '10 #6
techuse
19
can u tel me is there any other possible way to refresh a div part of page
May 14 '10 #7
gits
5,390 Expert Mod 4TB
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? ...
May 14 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
4
by: jensen bredal | last post by:
Hello, Is there a way to dynamically select how often my page should be refeshed? Any comment will be higly appreciated. Thanks JB
0
by: ratnakarp | last post by:
Hi, I have a.aspx page, which contains few buttons. On clicking one of the button, opens b.aspx. I have a button in b.aspx, on clicking, it closes the b.aspx and refreshes a.aspx. I'm able to...
8
by: Piotrek | last post by:
Hi all. I have the following problem: in my web app. I have to periodically refresh its content. It has to be done completely automatically. I tried using <meta> tag - it works great in IE...
7
by: Craig | last post by:
Hi I am trying to debug a problem with some ASP pages when accessed via IIS on Windows 2003 Server SP1. In summary, the pages are structured as follows: Root page Page loaded via IMG SRC ...
7
by: Luongo | last post by:
Hi, I'm looking for a way to refresh just one part of a page (a div layer) rather than the entire thing. It has been suggested to me that i use AJAX to do this - however I have no knowledge...
4
by: jurekk | last post by:
Hello, how can i refresh only small part of page (which shows new personal messages to users) every 60 seconds? without refreshing entire page. Im total noob in php or scripting, can anyone write a...
7
by: dream2rule | last post by:
Hello All, I have written a script that sends a mail to the administrator of the website at the end of the day. To do this i am checking whether system time is equal to the set time (this is the...
1
by: BHEEMA VAMSHI KRISHNA | last post by:
HI TO ALL This is vamshi i need a small help. Actually I am displaying one image by using html page . I want to refresh that page when that image changes. Can Any body Give the solution for...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.