我一直在寻找大约40分钟的方式来制作"输入"发送文本,但似乎没有任何东西与我的代码一起工作,我尝试了很多不同类型的jquery代码和函数,但似乎没有什么工作。我会承认我不是最好的网络编程但我尽我所能教育自己更多然后我在学校做。这是我的代码,它应该包括帮助我解决问题所需的一切。提前谢谢。
<?php
session_start();
if((!isset($_SESSION[ "usrname" ]) || $_SESSION[ "usrname" ] == "")||(!isset($_SESSION[ "color" ]) || $_SESSION[ "color" ] == "")) {
?>
<html>
<head>
<title>Chat Room Example</title>
<link rel="stylesheet" href="../css/main.css" />
</head>
<body>
<h1>Please choose a nickname and a color</h1>
<form action="../worker/login.php" method="post">
<table cellpadding="5" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">Nickname :</td>
<td align="left" valign="top">
<input type="text" name="usrname" maxlength="15" />
</td>
</tr>
<tr>
<td align="left" valign="top">Color :</td>
<td align="left" valign="top">
<select name="color">
<option value="000000">Black</option>
<option value="000080">Navy</option>
<option value="800080">Purple</option>
<option value="00FFFF">Aqua</option>
<option value="FFFF00">Yellow</option>
<option value="008080">Teal</option>
<option value="A52A2A">Brown</option>
<option value="FFA500">Orange</option>
<option value="CCCCCC">Gray</option>
<option value="0000FF">Blue</option>
<option value="00FF00">Green</option>
<option value="FF00FF">Magenta</option>
<option value="FF0000">Red</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top"></td>
<td align="left" valign="top"><input type="submit" value="Login" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}else{ ?>
<html>
<head>
<title>Chat Room Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="../worker/main.js"></script>
<link rel="stylesheet" href="../css/main.css" />
</head>
<body>
<div id="view_ajax"></div>
<div id="ajaxForm">
<input type="text" id="chatInput" /><input type="button" value="Send" id="btnSend" />
</div>
</body>
</html>
<?php }?>