这是我的ovhRecod.php:
<!-- Place this tag after the last widget tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
$(document).ready( function () {
$('#table_id').DataTable();
} );
</script>
&#13;
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="css/jquery.dataTables.js"></script>
</head>
<body>
<table class="table" style="width: 100%;">
<tr>
<td>
<div id="fb-root"></div>
<div style="overflow: auto;">
<?php
require_once ("OvhApi.php");
$phone = $_POST['name'];
echo $phone;
//echo '<pre>';var_dump($_POST);
// Action de test demandée
$action = @$_GET["action"];
// connexion
$cnx = mysql_connect($host,$user,$pass) or die("Impossible de se connecter");
$db = mysql_select_db("$bdd") or die("Impossible de se connecter");
$requete = "SELECT billingAcount
FROM persons
WHERE phone=".$phone;
$resultat = mysql_query($requete);
while ($data = mysql_fetch_array($resultat)) {
$billingAcount = $data['billingAcount'];
}
$ovh = new OvhApi();
$resp = $ovh->get('/telephony/'.$billingAcount.'/easyHunting/'.$phone.'/records');
sort($resp);
echo "<table id='table_id' class='table-style-two'>
<thead>
<tr>
<th> Début de l'appel</th>
<th> Fin de l'appel</th>
<th> Numéro appelant</th>
<th> Agent</th>
<th> Durée</th>
<th> Ecoute</th>
<th>Telechargement</th>
</tr>
</thead><tbody>";
foreach ($resp as $valeur) {
$test = $ovh->get('/telephony/'.$billingAcount.'/easyHunting/'.$phone.'/records/'.$valeur);
$nameAgent = $ovh->get('/telephony/'.$billingAcount.'/line/'.$test['agent']);
echo "<tr>";
echo "<td>".date('d/n/Y',strtotime($test['callStart']))." ".date('H:i',strtotime($test['callStart']))." "."</td>";
echo "<td>".date('d/n/Y',strtotime($test['callEnd']))." ".date('H:i',strtotime($test['callEnd']))." "."</td>";
echo "<td>".$test['callerIdName']." "."</td>";
echo "<td>".$test['agent']." - ".$nameAgent['description']." "."</td>";
echo "<td><center>".$test['duration']." sec"."</center></td>";
echo "<td> <audio controls='controls' preload='none'><source src=".$test['fileUrl']."></audio> </td>";
echo "<td> <center><a href=".$test['fileUrl'].">Télécharger</a></center></td>";
}
echo "</tbody></table>";
?>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
&#13;
我在JS Post上遇到了问题。这是我的代码:
</FORM>
<script type='text/javascript'>
/* attach a submit handler to the form */
$("#formoid").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
$.post("ovhRecord.php", {name: $('#phone').val()}, function(r){ $("#div1").html(r); });
});
</script>
&#13;
<FORM method="post" action="ovhRecord.php" id="formoid">
<?php
// connexion
$cnx = mysql_connect($host,$user,$pass) or die("Impossible de se connecter");
$db = mysql_select_db("$bdd") or die("Impossible de se connecter");
$requete2="SELECT *
FROM persons AS p, tbl_users AS u
WHERE p.user_id=u.user_id
And u.user_id =".$_SESSION['user_session'];
$result2=mysql_query($requete2);
while ($ligne=mysql_fetch_array($result2))
{
echo '<button type="submit" name="phone" style="width:99%;" value="'.$ligne["phone"].'">'.$ligne["nomLigne"].'</button></br>';
}
?>
</FORM>
&#13;
我的$.post("ovhRecord.php", {name: $('#phone').val()}
并未在ovhRecord.php
中返回任何内容。当我执行echo '<pre>'; var_dump($_POST);
时,它会返回:
array(0) {
}
有没有人有想法?