Why am I getting a syntax error after my Json result?
- by Mike
I'm using Json to retrieve data from a database, construct some html, and put it to the page, but I'm getting a syntax error after my tag, which is the last tag in the string from my php file.
PHP
if($QString == ""){
$query = "SELECT * FROM categories";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$categories="<a href=" . '"' . "?catID=" . $row['catID'] . '"' . ">" . $row['CatName'] . "</a><br>";
echo $_GET['jsoncallback'] . $categories;
}
}
jQuery
var jSon = {};
$(function(){
jQuery.jSon.getjSon();
});
jQuery.jSon = {
getjSon : function () {
$.getJSON('http://host6.spellnet.net/links/list.php?jsoncallback=?', function(json) {
eval(json.data);
});
}
Any Help would be greatly appreciated. I'm getting closer and closer.