All,
I’m using jQuery/AJAX to call a file to basically save it someone likes a song or not. I’m trying to do something like the following:
var html = $.ajax({
type: "POST",
url: "save_song.php",
data: "song_id=" + song_id + "&love_like_hate=hate",
async: false
}).responseText;
$("#div_song_id_"+song_id).html(responseText1);
$("#love_it").html(responseText2);
Then on the PHP side have something like this:
echo "This text would go in response text 1";
echo "This text would go in response text 2";
So basically I’m trying to have multiple echo’s in the save_song.php file and then basically say the first echo goes to the first div and the second echo goes to the second div that needs updated. Any idea how to do this?
Your PHP code could give back a JSON string:
Then you can parse it in jQuery: