//点击搜索
$("#searchBtn").click(function(){
var searchText= jQuery.trim($(".keyword").val());
var searchUrl =encodeURI("search.html?searchText="+searchText); //使用encodeURI编码
window.location.href =searchUrl;
})
//获取 上一个搜索页面传来的参数
var searchUrl =window.location.href;
var searchData =searchUrl.split("="); //截取 url中的“=”,获得“=”后面的参数
var searchText =decodeURI(searchData[1]); //decodeURI解码
$(".keyword1").val(searchText); //将搜索的数据显示在搜索页面的搜索框中
转载于:https://blog.csdn.net/qq_30979185/article/details/72794359?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1