【发布时间】:2011-12-15 07:56:18
【问题描述】:
情况是这样的:
在page1.php 上有一个数据网格,每一行都有一个视图链接。现在,当我单击视图链接时,它应该重定向到另一个页面,即 page2.php。在 page2.php 上,有 5 个复选框和一个输入表单(它实际上是一个带有提交按钮的搜索选项/功能)。我想从从数据库中提取的数据中预填充这些选项,该数据基于 page1.php 中“视图”链接的“ID”,然后根据预填充选项显示搜索结果。我应该如何解决这个问题?
这是我当前的代码
$('.view').click(function(){
var id = $(this).attr('id');
var userid = $('#userid').val();
window.location = './page2.php';
//I don't really know what to do here.
//assuming the db table is named testtable?
//am i just gonna use $.ajax() ?, if so,how will i extract the returned data
// in order to prefill the options on page2.php and at the same time
// show the result of the search based from the prefilled options?
});
【问题讨论】: