kucing Posted February 24, 2007 Share Posted February 24, 2007 Dear friends, I have search google and tested many examples I found but non of them work for me.. So now I need your help to solve this thing.. Actually what I wanted to do was save some variables from javascript to my database but when doing that I don't want my page to refreash and also don't want any button asking me to submit then save! Any thing will be best which do it automaticaly without clicking anywhere Here is my code example. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Java2php Test</title> </head> <body> <script type="text/javascript"> var N=5; var array = new Array() var items = list.getElementsByTagName("li") for (var i = 0, n = N; i < n; i++) { var item = items[i] array.push(myFnc(item)) } alert(array); // [b]<----- i want this array to forward to my php script[/b] return array.join('|') </script> <ul id="menu"> <li class="box" id=1>TEST1</li> <li class="box" id=2>TEST2</li> <li class="box" id=3>TEST3</li> <li class="box" id=4>TEST4</li> <li class="box" id=5>TEST5</li> <li class="box" id=6>TEST6</li> <li class="box" id=7>TEST7</li> <li class="box" id=8>TEST8</li> <li class="box" id=9>TEST9</li> <li class="box" id=10>TEST10</li> </ul> </body> </html> Thanks I appreciate your help. K Quote Link to comment Share on other sites More sharing options...
fert Posted February 26, 2007 Share Posted February 26, 2007 You would do this with Ajax Quote Link to comment Share on other sites More sharing options...
kucing Posted February 26, 2007 Author Share Posted February 26, 2007 You would do this with Ajax Thank you fert I found another good way to do that and it's only 1 line Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.