[JS|JSON|Ajax] Something not working right...

With the below code i can pull the data into the json array just fine but when i try to display it in the table i get nothing where did i screwup ?

[php]<?php

$userGuid = “b4a2635a-387e-4e65-a78d-af39790597ad”;
$queryID = “2b55904c-e178-457b-994a-e46e14a52eb7”;
$apiKey = “b4a2635a-387e-4e65-a78d-af39790597ad:gZkLppJpG0Z14X8jH8w7AEMHRRPs2+ZmPL7KGSdxLmyCnaCDlPJRWHGqGAbaKlPS9HQjJ8qYQHjL3K/YHtLndg==”;

// Issues a query request to import.io
function query($connectorGuid, $input, $userGuid, $apiKey) {

$url = "https://query.import.io/store/connector/" . $connectorGuid . "/_query?_user=" . urlencode($userGuid) . "&_apikey=" . urlencode($apiKey);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Content-Type: application/json",
	"import-io-client: import.io PHP client",
	"import-io-client-version: 2.0.0"
));
curl_setopt($ch, CURLOPT_POSTFIELDS,  json_encode(array("input" => $input)));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);

return json_decode($result);

}

// Query for tile Integrate Page Example
$result = query($queryID, array(
“pageUrl” => “http://vs1.brassmonkeymilitia.net/amxbans/ban_list.php","offset” => “0”
), $userGuid, $apiKey, false);
//var_dump($result);
$banList = json_encode($result);
?>


Var Dump $result

<?php print_r($result); ?>

Var Dump $banList
<?php print_r($banList); ?>
[/php]
Date Player Admin Reason Length

Well, your code looks correct to me. Can you post a small bit of your $banlist variable using:
Print_r($banlist); So that we can see the data format.

It might be a conversion issue. JS/AJax variables should accept a standard PHP array, but, sometimes you
must tell it is an array. If so, you can alter your assignment like this:

var banList = new array();
var banList = “<?php echo $banList; ?>”;

JS normally does this if the variable name has not been assigned as yet, but, I did see this fix it once.
I suspect that it is a conversion issue from PHP to JS… Let us know…

Sponsor our Newsletter | Privacy Policy | Terms of Service