我目前正在使用一些 jQuery 来获取 td 单元格中的内容。然后我通过一个变量将该内容传递给另一个文件。我正在尝试找出获取会话变量的最佳方法,并且似乎已经陷入困境。下面是一些简短的伪代码以及我的 JS/jQuery。
编辑/更新
更正下面的帖子。这是我的 ManageUsers.inc.php
<?php
// Load 404 page if file is accessed directly
if(!defined('INCLUDE_CHECK')) die(header("HTTP/1.0 404 Not Found"));
// Load 404 page if the page is accessed by Users or QA Agents
if($_SESSION['role_id']<2 or $_SESSION['role_id']==5) die(header("HTTP/1.0 404 Not Found"));
?>
<script src="/resources/js/getBusinessUnit.js"></script>
<script type="text/javascript" src="../../resources/js/User.js"></script>
<div id="main">
<div class="container">
<h1>Manage Users</h1>
<h2>This page allows you to add and update the authorized Users</h2>
</div>
<div class="container">
<div style="margin-left:auto; margin-right:auto; text-align:center;">
<span id="user">
<form name="insertUser" action="<?php echo htmlspecialchars($_SERVER['PHP']);?>" method="post">
<div style="margin-top:0px; margin-left:auto; margin-right:auto; text-align:center;">
<fieldset>
<legend class="legend1"><h2>  User Info  </h2></legend>
<div style="padding-top: 5px;">
<input type="text" name="uname" class="textinput1" id="uname" value="" style="width:200px;" maxlength="200" tabindex="2" placeholder="User Name" /><br />
<input type="text" name="fname" class="textinput1" id="fname" value="" style="width:200px;" maxlength="100" tabindex="3" placeholder="First Name" /><br />
<input type="text" name="lname" class="textinput1" id="lname" value="" style="width:200px;" maxlength="100" tabindex="4" placeholder="Last Name" /><br />
<div style="float:left"><input type="checkbox" name="status" id="status" value="YES"/>Enabled </div>
</div>
</fieldset>
<fieldset>
<legend class="legend1"><h2>  Company Info  </h2></legend>
<div style="padding-top: 5px;">
<div class="input-field">
<?php require $adm_pg.'selectRole'.$ext; ?>
</select>
</div>
<div class="input-field">
<?php require $adm_pg.'selectBusinessUnit'.$ext; ?>
</div>
<span id="DeptContainer"></span>
</div>
</fieldset>
</div>
<?php require $adm_pg.'adminButtons'.$ext; ?>
</form>
</span>
</div>
</div>
<div class="container">
<?php require $adm_pg.'displayUsers.inc.php'; ?>
</div>
</div>
<?php
require 'db/ManageUsers.db.php';
require 'db/logAction.db.php';
?>
这是我的 User.js 文件
$(window).on('load', function() {
$('.user').on('click', function() {
var id = $(this).html();
$.get("/includes/adminPages/Update_User.inc.php?selection_id=" + id, function(data) {
$('#user').html(data);
});
});
});