简体   繁体   中英

http and ajax request simulation

I have the following url

 http://mywebsite/mypages

when you go to this url it will display a list of links, for example

 http://mywebsite/pages?page=1
 http://mywebsite/pages?page=2
 ...

when the user click on one of these links, an ajax request will be executed to bring the content of this page and then display the content in the same page (by same page i mean mywebsite/mypages).

The question is: how can i simulate this behavior?. for example a user has a link:

 http://mywebsite/simulation?page=http://mywebsite/pages?page=1

when a user click this url, i want to redirect him/her to mywebsite/mypages and simulate a click on the link

 http://mywebsite/pages?page=1 

so the user can see the content of this page.

First read the url from the url parameter and store it in a server side control (eg a hidden field). Then redirect to http://mywebsite/mypages , read your hidden fields value and perform your ajax request with it.
Alternatively you could store it somewhere else server side, eg a database.

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