gpt4 book ai didi

javascript - Php echo 显示 br 标签

转载 作者:行者123 更新时间:2023-11-30 17:35:05 25 4
gpt4 key购买 nike

我有一个 HTML 表单。当您单击提交按钮时,它会将框中的数据存储到一个表中,然后显示一条消息。消息从 PHP 文件发送,然后由 HTML 文件中的 js 显示。问题是消息有 br其中的标签,当显示消息时,它显示 <br>标记而不是断行。

这是我测试它的地方 - http://ft5.cu.cc/单击心形 Logo 以查看表格。

HTML 格式

<div class="contact">
<form method="post" action="daalo.php">
<input type="text" maxlength="30" class="text" name="ign" id="ign" placeholder="Please type your IGN(In Game Name)" required="required"/>
<input type="email" maxlength="30" class="required email" name="email" id="email" placeholder="Please type your email" required="required"/><span class="status"></span>
<table width="100%">
<tr>
<td><input type="text" maxlength="30" class="text" id="steamid" name="steamid" placeholder="Enter your Steam ID" required="required"/></td>
<td><span class="status">
<img id="tick" alt="Good"src="images/tick.png" width="16" height="16"/></td>
</tr>
</table>
<span id="cross">Steam Id Already Added</span>
</span>
<input type="submit" name="register" id="register" value="Submit" disabled="disabled" />
</form>
<div id="loading">Processing your <b>WHITELIST</b> entry....</div>
<div id="success"></div>
</div>

*Php 插入*

<?php
include('connecti.php'); //Ganja Login


// Check connection
if (mysqli_connect_errno())
{
echo 'Failed to connect to MySQL: ' . mysqli_connect_error();
}

//Insert
$lab1='IGN<br>';
$lab2='Email ID<br>';
$lab3='Steam ID<br>';
$lab4='Submitted.';
$lab5='Whitelist is updated everyday at 8pm (UTC+01:00) Brussels, Copenhagen, Madrid, Paris.';

$sql="INSERT INTO rusty_whitelist (name, email, steamid) VALUES ('$_POST[ign]','$_POST[email]','$_POST[steamid]')";

if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo $lab1;
echo $lab2;
echo $lab3;
echo $lab4;
echo $lab5;

mysqli_close($con);
?>

Java 脚本

(function($) {
$('form').submit(function(e){
var thisForm = $(this);
e.preventDefault();
$(this).fadeOut(function(){
$("#loading").fadeIn(function(){
$.ajax({
type: 'POST',
url: thisForm.attr("action"),
data: thisForm.serialize(),
success: function(data){
$("#loading").fadeOut(function(){
$("#success").text(data).fadeIn();
});
}
});
});
});
});
$('.md-trigger').tipsy({gravity: 's'});
})(jQuery);

$(function(){
$().ready(function() {
$('#videobg').tubular({videoId: 'tDvBwPzJ7dY'}); // where idOfYourVideo is the YouTube ID.
});
});

最佳答案

我认为问题在于您如何在代码中使用 Ajax 返回的值。尝试使用 .html() 方法,而不是使用 jQuery .text() 方法。

关于javascript - Php echo 显示 br 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22210264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com