jquery json function returning null
- by ian
I have a jquery script as below:
$.ajax({
   type: "GET",
   url: "http://www.site.com/v4/ajax/get_song_info.php",
   data: ({id : song_id }),
   dataType: "json",
   success: function(data)
   {
      alert( "Data: " + data );
   }
 });
And the associated php page:
<?php
    include_once '../connect.php';
    $song_id = $_GET['id'];
    $query = mysql_query("SELECT * FROM songs WHERE id = '$song_id' LIMIT 1");
    $song = mysql_fetch_row($query);
    $song_info = array( htmlentities($song[3]) , htmlentities($song[4]) );
    header('Content-Type: application/json');
    echo json_encode($song_info); 
?>
The php returns something like this when I call it on its own in a browser: ["Peaches","I Feel Cream (Proxy Remix)"]
However when I make the jQuery call my alert shows 'Data: null'