gpt4 book ai didi

php - 通过邮寄方式发送数据和通过邮寄方式接收数据

转载 作者:行者123 更新时间:2023-11-28 01:51:57 25 4
gpt4 key购买 nike

我已经在我写 ID 的地方输入并点击按钮来检查我是否有这样的 ID(按功能)。数据通过 jquery 和运行功能进入第 2 页进行检查,我什至可以将其打印到屏幕上。我需要将数据从第二页的功能发送到我的主页并使用这些数据。如何在不提交的情况下从第 2 页发送它?

我的第一页:

$(function() {
$("#checkfin").click(function() {
var fin = $("#pinofsv").val();

$.post("checkfin.php", {
ffin: fin
}, function(result) {
$('#result').append(result);
});
});
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<form name="formids" id="formids" action="" method="POST">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<label>Enter your ID: <span style="color:#FF0000;">*</span></label>
</div>
<div class="col-sm-4">
<div class="input-group">
<input type="text" class="form-control input-sm" name="pinofsv" id="pinofsv" required />
<div class="input-group-addon"><a href="#" onmouseover="document.getElementById('place-holder-1').src='../svphoto.jpg';" onmouseout="document.getElementById('place-holder-1').src='';"><i class="glyphicon glyphicon-info-sign blue"></i><img src="" id="place-holder-1" style="z-index: 100; position: absolute;right: 1%;" /></a></div>
</div>
</div>
<div class="col-sm-5">
<div class="col-sm-5">
<button class="btn btn-primary" name="checkfin" id="checkfin" onclick="return false">Check </button>
</div>
<div class="col-sm-7">

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>

<div id="result"></div>


我的第二页:

if(isset($_POST["ffin"]) && $_POST["ffin"] != "")
{
$fintrue = definePINNew($fin);
if($fintrue != "")
{
//do something for example print to screen data from function
}

}

最佳答案

只要你发送请求,你就会得到响应

if(isset($_POST["ffin"]) && $_POST["ffin"] != "")
{
$fintrue = definePINNew($fin);
if($fintrue != "")
{
echo 'JUST SEND YOUR DATA IT WILL BE THERE IN JQUERY RESPONSE';

Eg: echo json_encode($fintrue['anydata']);
// it will give you $_POST data in jquery response.
// which is at your first page.
// And parse data in JSON can easily get in jquery response


}
}

$(function() {
$("#checkfin").click(function() {
var fin = $("#pinofsv").val();
$.post("checkfin.php", {
ffin: fin
}, function(result) {
console.log(result.anydata); // you will get the data from second page here.
// result.anydata you can place it anywhere.
});
});
});

关于php - 通过邮寄方式发送数据和通过邮寄方式接收数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49871516/

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