I have searched for that error and looked up many posts.. but i still can't figure out what is wrong with this code here:
my ajax call:
function myCall3() {
$.ajax({
type:"POST",
url:"ajax3.php",
dataType:"json",
success:function(response){
alert(response[0]);
}
});
}
my mysql/php code:
<?php
// QUERY NEW VINE
$array = array();
$myquery = "SELECT * FROM table1 ORDER BY rand() LIMIT 9";
$result = mysql_query($myquery)
OR die("Error: $myquery <br>".mysql_error());
while($row = mysql_fetch_object($result)){
$currentid = "$row->id";
$currentname = "$row->name";
$currenturl = "$row->url";
$currentimage = "$row->image";
$array[] = array('id'=>$currentid,'url'=>$currenturl,'name'=>$currentname,'image'=>$currentimage);
}
echo json_encode($array);
?>
when i alert the error it says:
SyntaxError: SyntaxError: JSON.parse: unexpected character