【发布时间】:2019-11-11 21:08:52
【问题描述】:
我想通过 API 请求为表格上方的日期和子 ID 添加两个搜索器
这是我的 php 代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<?php
$xml = new SimpleXMLElement('https://partners.sites.com/affiliates/api/1/reports.asmx/Conversions?api_key=aaaaaaaaa&%20affiliate_id=11111&start_date=06/01/2019+00:00:00&end_date=06/31/2019+00:00:00&conversion_id=&subid_3&include_tests=false&start_at_row=1&row_limit=200'.$_GET["callsign"], 0, TRUE);
?>
<body>
<table class="outer">
<table class="middle">
<table class="inner">
<thead>
<tr>
<th>DATE</th>
<th>NAMA OFFER</th>
<th>NEGARA</th>
<th>PAYOUT</th>
<th>USER</th>
</tr>
</thead>
<tbody>
<?php foreach ($xml->conversions->conversion as $datanya) :?>
<tr>
<td><?php echo $datanya->conversion_date; ?></td>
<td><?php echo $datanya->offer_name; ?></td>
<td><?php echo $datanya->country; ?></td>
<td><?php echo $datanya->price_usd; ?></td>
<td><?php echo $datanya->subid_3; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</table>
</table>
</table>
</body>
</html>
还有其他方法,比如过滤变成表格的结果吗?
【问题讨论】:
-
Hmm.. 添加两个输入字段 + 按钮,JS 从按钮和值中捕获事件,并根据您的 API 请求中的值设置日期?
-
是的,就是这样。对不起,我的英语不好
-
你可以添加一个 jQuery 数据表插件到你的页面 (datatables.net) 这将为你排序、分页和搜索字段。