简体   繁体   中英

How to update a url without refreshing the complete PHP page using the JavaScript?

I am using the below JS for making a url:

function reload(form){
var val1=form.dav.options[form.dav.options.selectedIndex].value;
var val2=form.pathogen.options[form.pathogen.options.selectedIndex].value;
var val3=form.topicF.options[form.topicF.options.selectedIndex].value;
var val4=form.ind.options[form.ind.options.selectedIndex].value;
var val5=form.subind.options[form.subind.options.selectedIndex].value;
self.location='/node/1?davQ=' + val1 + '&pathogenQ=' + val2 + '&topicQ=' + val3 + '&indQ=' + val4 + '&subindQ=' + val5;

This code works well, but the problem is every time its run the page flick's and all elements appear after a blink!

How can I prevent the page flicker/blinks. I use this function in onchange of list box in the page to update the url.

Is there any alternative way to do this? Please help.

Note:

In this case the url is added to the address location when the first listbox value is selected and all other parameters get update while user selects the other listboxes and finally the submit the page its run a query in database using the value get stored in the url.

http‍://localhost:8080/lspo/data10.php?davQ=30-Aug-11&pathogenQ=&topicQ=&indQ=&subindQ= so when ever drop downs are selected each parameter updates. Is this can be done using any other method which the page will stay as smooth as it is ? Please help/advice in this matter.

02-05-2012

When a dropdown value is selected, its value is updated in addressbar url, at the same time it get updates in field and with respect to that the next drop down field value is generated (sql query from mysql db). Please help me to solve this issue.

09-05-2012
I was unable to find a solution up to now, I had gone through the suggestion and couldn't able to solve the issue. Is there any other suggestions. It will be a real help for me if there any and thank you very much for the responses.

history.push()

http://html5doctor.com/history-api/

or use something like swfaddress

javascript中有哈希函数,或者你可以使用html5历史API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM