Why am I getting a syntax error after my Json result?
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-04-13T19:01:03Z
Indexed on
2010/04/13
19:03 UTC
Read the original article
Hit count: 305
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.
© Stack Overflow or respective owner