I have some ten html pages each page has same search tab, when i click search button from any of the page it navigates to index page with search text passed through query string and displays output on 开发者_JAVA百科the index page . How can i write click on the index page with search parameters entered from index page search tab and display the results on the index page. I used the following logic: example1.html ......
$("#SearchButton").click(function() {
var address = ($("#s1").val());
var keyword2 = ($("#s2").val());
var radius2 = ($("#s3").val());
$.cookie("spaddress", address);
$.cookie("spkeyword", keyword2);
$.cookie("spradius", radius2);
window.location.href = "http://localhost:4745/blsk22-9-2010/seek.html?page1=1";
});
...... .. index.html .....
$(document).ready(function() {
var page1 = Request.QueryString("page1");
alert(page1);
if (page1 == 1) {
map = new GMap2(document.getElementById('SearchMap'));
var keyword1 = $.cookie('spkeyword');
var radius = $.cookie('spradius');
var address1 = $.cookie('spaddress');
....
....
}
else
{
$("#SearchButton").click(function() {
var keyword1 = ($("#text1").val());
var radius = ($("#radiusSelect").val());
var address1 = ($("#addressLocation").val());
....
.....
.....
}
Use document.referrer to find out what page was used to get to the current page, and .serialize to convert input values into query string parameters.
精彩评论