Amigo pongo lo de new Array(); y mas bien deja de funcionar. La variable esta llegando bien pero hay algo que yo estoy haciendo mal y no me esta funkando. Pongo aca todo mi cod y me dicen en que estoy fallando:
JS:
Código Javascript
:
Ver original$(document).ready(function() {
var array = new Object();
array['tag'] = "NFL";
$.ajax({
type: "POST",
data: array,
url: 'livescore.php',
});
});
PHP:
Código PHP:
$response = array();
if (isset ($_POST['tag']) && $_POST['tag'] != '') {
$response['tag'] = $_POST['tag'];
error_log('tag: '.$response['tag']);
}
print_r('response: '.$response);
echo json_encode($response);
foreach ($games as $group) {
if($group['league'] == $response['tag']){ // ACA DEBO DE COMPARAR CON LA VARIABLE QUE VENGA DESDE EL JQUERY POR AJAX.
echo '<table class="item sporTitle '.str_replace(' ', '', $group['league']).'">';
echo "<tr><td>".$group['league']."</td></tr>";
echo "</table>";
foreach ($group['groupeddata'] as $gameDetails) {
if(trim($gameDetails['status']) == ""){
echo '<table class="item empty '.str_replace(' ', '', $group['league']).'" title="'.$gameDetails['homeName'].' at '.$gameDetails['awayName'].'">';
echo "<tr><td>".$gameDetails['home']." @ ".$gameDetails['away']."</td></tr>";
echo "<tr><td>".$gameDetails['time']."</td></tr>";
echo "</table>";
}else{
echo '<table class="item full '.str_replace(' ', '', $group['league']).'" title="'.$gameDetails['homeName'].' at '.$gameDetails['awayName'].'">';
echo "<tr><td class=\"team , teamHome\">".$gameDetails['home'].'</td>';
echo "<td class=\"point pointHome\">".$gameDetails['hScores']."</td>";
echo "<td class=\"status\" rowspan=\"2\">".$gameDetails['status'].'</td>';
echo "</tr>";
echo "<tr><td class=\"team\">".$gameDetails['away'].'</td>';
echo "<td class=\"point\">".$gameDetails['aScores'].'</td>';
echo "</tr>";
echo '</table>';
}
}
}
}