Question : why i need to refresh the page again and agin when i am editing the records.

i am using ajax and showing the edit form in a hidden div. records are successfully updated and my edit form div also hides when i click on the edit button as i want. now the main problem is coming that i need to refresh the page to see that the record has been updated or not.

this is very easy but i am really not getting any idea. i have tried many times but need to refresh the page means press F5.

why is this so?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
index.php
 

Edit
editform.js function editform(id){ var obj=document.getElementById("editform"); h.open('get','editform.php?id='+id); h.onreadystatechange=function(){ if(h.readyState == 4){ obj.innerHTML=h.responseText; } } h.send(null); } function editq(){ var id1=document.getElementById("id1").value; var n=document.getElementById("name1").value; var a=document.getElementById("address1").value; var obj1=document.getElementById("display1"); h.open('get','editq.php?id='+id1); h.onreadystatechange=function(){ if(h.readyState == 4){ obj1.innerHTML=h.responseText; } var obj2 = document.getElementsByTagName('div'); obj2['editform'].style.visibility = 'hidden'; } h.send(null); } editform.php
Open in New Window Select All

Answer : why i need to refresh the page again and agin when i am editing the records.

You must specify "true" for asynchronous calls:

1:
h.open('get','editform.php?id='+id, true);
Open in New Window Select All
Random Solutions  
 
programming4us programming4us