- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请给我一个提示,我如何开始使用 anchor 点击中的 ID 显示用户个人资料。
我的主页网址是localhost/CRM/dashobard.html
。另外,我有完整的 JSON,其中我已经获取了所有潜在客户详细信息,并且我通过文件 dashboard.html
中的表格在列中显示其一些内容。
也在 dashboard.html
文件我正在使用 PHP session ,如下所示。
<?php
session_start();
if($_SESSION['State'] == 'Authenticated'){
$user_id = $_SESSION['User_Id'];
if(function_exists('date_default_timezone_set'))
{
date_default_timezone_set("Asia/Kolkata");
}
$today = date("Y-m-d H:i:s");
?>
<!DOCTYPE html>
<html>
<head>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Dashboard</title>
</head>
<body>
all header and sections tag content are there
</body>
</html>
<?php
}else{
echo "<script>location.href='https://localhost/CRM/login.html';</script>";
}
?>
我想显示 localhost/CRM/dashboard.html/17/John-doe
中的用户个人资料或localhost/CRM/dashboard.html/lead/17/
我有一张 table Lead Name
在列值中。我想允许用户单击 Lead Name
并且在新选项卡中向用户显示一个单独的页面,其中包含除表格中不存在的其他列之外的所有其他详细信息,这可以通过动态创建个人资料页面来完成,但因为我不知道哪个 Lead Name
被访问用户点击。我想我缺乏URL转发的概念。
下面是前端截图。
我正在使用 AJAX 动态生成上表,并且表中有带有 anchor 标记的行 Lead Name
用户可以单击并访问个人资料页面。但我认为这需要动态生成 HTML 页面,但我不知道该怎么做。
例如,在下面的代码文件 loadtable.js
中.
$(document).ready(function() {
var delay = 1000;
// Campaign Submit Info
$('[name="search_submit"]').click(function(e) {
e.preventDefault();
var lead_status = $('#filterformpost').find('#lead_status_select option:selected').val();
var campaign_status = $('#filterformpost').find('#campaign_status_select option:selected').val();
var company_name = $('#filterformpost').find('#company_name_select option:selected').val();
var tech_area = $('#filterformpost').find('#tech_area_select option:selected').val();
var firm_size = $('#filterformpost').find('#firm_size_select option:selected').val();
var firm_type = $('#filterformpost').find('#firm_type_select option:selected').val();
var country_name = $('#filterformpost').find('#country_name_select option:selected').val();
var state_name = $('#filterformpost').find('#state_name_select option:selected').val();
var start_date = $('#filterformpost').find('#start_date_search').val();
var end_date = $('#filterformpost').find('#end_date_search').val();
$.ajax({
type: "POST",
url: "./server/search.php",
data: {
"lead_status": lead_status,
"campaign_status": campaign_status,
"company_name": company_name,
"tech_area": tech_area,
"firm_size": firm_size,
"firm_type": firm_type,
"country_name": country_name,
"state_name": state_name,
"start_date": start_date,
"end_date": end_date
},
beforeSend: function() {
$('.message_box').html(
'<img src="tenor.gif" width="40" height="40"/>'
);
},
success:function(data){
var result = $.parseJSON(data);
console.log(result);
$("#filterRecords").empty();
var table='';
table = $("<table></table>");
table.append('<thead><th>#</th><th>Lead Name</th><th>Company</th><th>Email</th><th>Phone</th><th>Lead Owner</th><th>Details</th></thead>');
table.append('<tbody></tbody>');
var i = 1;
$.each(result, function(key, value) {
table.last().append("<tr><td>" + i + "</td><td><a target='_blank' class='lead-name' href="+value['Lead_Id']+">" + value['FirstName'] + ' ' + value['LastName'] + "</a></td><td>" + value['Company'] + "</td><td><a href=mailto:" + value['Email'] + ">" + value['Email'] + "</a></td><td>" + value['Phone'] + "</td><td><a target='_blank' class='lead-owner' href=" + value['LeadAddedBy'] +">" + value['LeadAddedBy'] + "</td><td>" + "<form action='' method='POST'><button id=" + value['Lead_Id'] + " name=''>View</button></form>"+"</td></tr>");
i = i + 1;
});
$("#filterRecords").html(table);
$('.message_box').html('');
}
});
});
});
在运行 SQL 查询并返回 JSON 对象的 PHP 文件中。
<?php
// send a JSON encoded array to client
include('connection.php');
$selectSQL = "SELECT * FROM tbl_main_lead_info ";
$result_array = array();
$result = $conn -> query ($selectSQL);
// If there are results from database push to result array
if(mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_array($result)) {
array_push($result_array, $row);
}
}
echo json_encode($result_array);
$conn->close();
?>
在显示表格的文件中dashboard.html
<!-- Filter section with Main Lead Table -->
<section class="operation" id="view_lead_info" style="display: block;">
<div class="row">
<div class="col">
<div style="overflow-x:auto;">
<div id="filterRecords"></div>
</div>
</div>
</div>
</section>
用于显示配置文件的表的 SQL。
--
-- Table structure for table `tbl_main_lead_info`
--
DROP TABLE IF EXISTS `tbl_main_lead_info`;
CREATE TABLE IF NOT EXISTS `tbl_main_lead_info` (
`Lead_Id` int(100) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(100) DEFAULT NULL,
`LastName` varchar(100) DEFAULT NULL,
`Company` varchar(100) DEFAULT 'NA',
`Website` varchar(100) DEFAULT 'NA',
`Designation` varchar(100) DEFAULT 'NA',
`Linkedin` varchar(100) DEFAULT 'NA',
`Email` varchar(100) DEFAULT NULL,
`Phone` varchar(100) DEFAULT NULL,
`State` varchar(100) DEFAULT NULL,
`Country` varchar(100) DEFAULT NULL,
`TechArea` varchar(100) DEFAULT NULL,
`FirmType` varchar(100) DEFAULT NULL,
`FirmSize` varchar(100) DEFAULT NULL,
`LastContactDate` date DEFAULT NULL,
`NextContactDate` date DEFAULT NULL,
`LeadDescription` varchar(200) DEFAULT NULL,
`OwnerNotes` varchar(200) DEFAULT NULL,
`SetReminder` date DEFAULT NULL,
`AdminNotes` varchar(200) DEFAULT NULL,
`LeadStatus` varchar(100) DEFAULT NULL,
`LeadAddedBy` int(100) NOT NULL,
`LeadAddedOn` datetime DEFAULT NULL,
PRIMARY KEY (`Lead_Id`),
UNIQUE KEY `FirstName` (`FirstName`,`LastName`,`Company`,`Website`,`Designation`,`Linkedin`,`Email`,`Phone`)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_main_lead_info`
--
INSERT INTO `tbl_main_lead_info` (`Lead_Id`, `FirstName`, `LastName`, `Company`, `Website`, `Designation`, `Linkedin`, `Email`, `Phone`, `State`, `Country`, `TechArea`, `FirmType`, `FirmSize`, `LastContactDate`, `NextContactDate`, `LeadDescription`, `OwnerNotes`, `SetReminder`, `AdminNotes`, `LeadStatus`, `LeadAddedBy`, `LeadAddedOn`) VALUES
(18, 'Tohn', 'Doe', 'Microsoft', 'www.microsoft.com', 'Manager', 'Tohn Doe', 'tohndoe@microsoft.com', '5125501556', 'California', 'USA', 'Wireless technologies', 'Corporate', '1000+', '2020-01-27', '2020-01-31', 'This is a testing description', NULL, '2020-02-27', 'This is Admin Notes Testing', 'Active', 18, '2020-01-15 10:50:36'),
(17, 'John', 'Doe', 'Google', 'www.google.com', 'Manager', 'John Doe', 'johndoe@google.com', '5125501555', 'Texas', 'USA', 'Intellectual Property', 'Corporate', '11-50', '2020-01-14', '2020-01-25', 'This is a Testing Description', 'This is My Notes Belongs to Rinku 16', '2020-01-17', NULL, 'Active', 22, '2020-01-14 17:04:02');
最佳答案
要根据某些数据动态创建页面,您需要 PHP。假设您的页面是这样的:
show-profile.php
$lead_id = $_GET[ 'lead_id' ]; // Get the lead_id value, of course you'd need to check if it has been set, is valid, etc.
... here your code to retrieve info through the $lead_id value ...
在你的表格中放置一个像这样的链接就足够了:
"<a target='_blank' href='show-profile.php/?lead_id=" + value['Lead_Id'] + "'>Show Details</a>"
编辑
这是 show-profile.php 页面的更详细示例:
<?php
if ( ! isset( $_GET[ 'lead_id' ] ) {
echo( 'No parameter lead_id given' );
exit;
}
$lead_id = $_GET[ 'lead_id' ];
$data = get_details( $lead_id );
# Here you can check about the $data returned, which depends by your get_details function, to check if the details has been found or not and act consequently. Here we suppose you got the right data to make it short.
?>
<!-- HTML page definition, HTML, HEAD, LINKS, etc. goes here -->
<body>
<div id="details">
<p class="first-name">First Name: <?php echo $data[ 'first_name' ] ?></p>
<p class="last-name">Last Name: <?php echo $data[ 'last_name' ] ?></p>
<!-- other data to show here -->
</div>
</body>
当然,在代码中,get_details 是您通过 $lead_id 值检索数据的函数。
编辑2:已获取JSON数据
假设您要显示的数据存在于 JSON 对象中:
data = {
lead_id: 20,
first_name: 'John',
last_name: 'Doe',
}
打开详细信息页面的链接将如下所示:
"<a target='_blank' href='show-profile.php/?lead_id=" + data.lead_id + "&first_name=" + data.first_name + "&last_name=" + data.last_name + "'>Show Details</a>"
您的 show-profile.php 页面将如下所示:
<?php
# Check if all the data you need has been given
... your code ..
# Retrieve the data and store them into variables
$lead_id = $_GET[ 'lead_id' ];
$first_name = $_GET[ 'first_name' ];
$last_name = $_GET[ 'last_name' ];
?>
<html>
<head></head>
<body>
<p class="first-name">First Name: <?php echo $first_name; ?></p>
<p class="last-name">Last Name: <?php echo $last_name; ?></p>
<!-- other data to show here -->
</body>
</html>
关于javascript - 如何根据表中的用户链接点击生成新的 HTML 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59819107/
假设我有父页面。 当我单击“打印”时,会打开一个新选项卡(页面)以进行打印预览。 我想要的是,当我单击“打印”时,父选项卡(页面)上应显示覆盖层,以停止进一步的工作,直到子选项卡关闭。 Because
我知道这是不可能的,但我想我还是会问这个问题。 我有一个 HTTPS 页面,并且正在动态创建一个表单。我想将表单发布到 HTTP 页面。在浏览器不弹出警告的情况下这可能吗?当我在 IE8 上执行此操作
在我的应用程序中,我实现了ajax 4.0客户端模板 目前我的模板位于同一个.aspx页面上。 (例如 Main.aspx) 但我想将它们外部化。(即所有 HTML 都会放在另一个页面上) 为此,我使
我目前正在构建自己的网络应用程序。在此应用程序的标题中有一个导航栏。 我将相同的导航栏添加到我的所有 html 页面,以便在页面之间导航时保持可见,并将导航元素设置为事件到我现在所在的页面。 我的
我们有一个在集成管道下运行的 IIS7 Intranet 站点,该管道主要是 ASP.Net,带有一些传统的经典 ASP 页面。该站点允许匿名访问大多数区域,但使用 Windows 身份验证来保护某些
有一个要求,我需要根据 div 标签的高度超过 700 像素的条件将大型 HTML 页面拆分为多个页面。 我还可以根据字数拆分页面。 下面的示例根据 HTML 标签分割页面,而我需要根据 div 高度
有两个 html 页面,如果在第一个页面中单击特定图像,它将转到第二个 html 页面。如果在第二个 html 页面上的任何地方单击它应该返回到第一页并将第二页完全显示在第一页的一个 div 中 1s
我有一个简单的 hello world Servant 应用程序。我需要向它添加一些静态或动态的 html 页面。我怎样才能做到这一点?在文档中没有提到它。注意我不想在 Haskell 代码中创建 h
我有两个文件 index.html 和 index2.html。这两个文件都在本地机器上的同一目录中(无法访问 PHP 等)。 我正在努力 Page Title 使用 jQuery 从 index.h
假设我有一个 JSP 页面 index.jsp User id:
我面临着一个对我来说非常陌生的情况。我会尽力让事情变得简单来解释它一步一步来。 1)在页面 A(用户表单)中,我从字段中获取一些值并将其作为 jQuery AJAX POST 发送到页面 B。这是主要
我正在尝试弄清楚如何从 buttons.html 获取用户按钮点击动态切换第二个列的可见性 userinput.html 。我正在使用 DataTables userinput.html表并认为我有
我有asp。净 mvc4 项目。 Angularjs 已集成。 我已经按照以前的要求构建了 HTML 页面和 WEB API 2。 现在出于某种原因,我必须使用 CSHTML 页面。以前我只有 web
我的网站包含大约 18 个不同的页面。以管理员身份登录后,我单击“页面”。 我看到了以下内容 All (20) | Mine (19) | Published (19) | Draft (1) No
Haskell 中每个函数都有手册页吗?换句话说,我可以在某处输入 man fst 并获取有关该函数的手册或帮助页面吗?我发现大量的功能势不可挡! 我正在使用 GHC 和 GHCi。 最佳答案 我不知
我一直在用github pages很长一段时间以来,并使用自定义域重定向功能来重定向我的 user website来自 prahladyeri.github.io到我自己的域名 https://www
我对 Github 有一个基本的了解:我知道如何创建、添加、提交、推送和克隆存储库。我也开始探索 Github 页面来托管我的项目。我的最新项目于 3 月开始并将其推送到 gh-page。从那以后,我
在尝试查看日志时,Airflow 会抛出一个带有以下消息的 oops 页面: File "/Users/user/.pyenv/versions/3.5.2/lib/python3.5/locale.
我已经按照此处列出的步骤 (https://pages.github.com/) 为我正在处理的网站设置了一个 GitHub 页面 我设置的站点当前托管在 IIS 下,并使用 URL Rewrite
我想将我的 domain.com 重定向到 openshift 页面 (openshift-app.rhcloud.com)。我已经按照描述完成了 here它有效。唯一的问题是,在任何网站上,我都不会
我是一名优秀的程序员,十分优秀!