I need to populate my Meta tags using Jquery returned data
===

I have been trying to figure this out for a while now. I see this question often, but no real clear answer. 

I need to populate meta data with data pulled from a PHP completed form.

1... I have a PHP script.....

    <?php
    
    	// Change to your database user name
    	$username="*********"; 
    	
    	
    	//Change to your database password
    	$password="*********"; 
    	
    	
    	// Change to your database name
    	$database="********"; 
    	
    	// Connect to the database	
    	mysql_connect('********',$username,$password);
    	
    	// Handle an error
    	@mysql_select_db($database) or die( "Unable to select database");
    
    		// Build Sql that returns the data needed - change this as required.	
    		$sql = "SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist,songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='C' OR songlist.songtype='N') ORDER BY historylist.date_played DESC LIMIT 1";
    		
    		
    		// Store results in result object
    		$result = mysql_query($sql);
    		
    		
    		 //store values in vars for calculation for array creation
    		$curPlay = mysql_query("SELECT * FROM historylist ORDER BY date_played DESC LIMIT 1");
    		$curPlayRow = mysql_fetch_assoc($curPlay);
    		if (!$curPlay) { echo( mysql_error()); }
    		$dt_duration = mysql_result($result,$i,'duration');
    		$title= mysql_result($result,$i,'title');
    		$artist= mysql_result($result,$i,'artist');
    		$album= mysql_result($result,$i,'album');
    		$picture= rawurlencode(mysql_result($result,$i,'picture'));
    		$lyrics= mysql_result($result,$i,'lyrics');
    		$ID= mysql_result($result,$i,'ID');
    		$curtime = time();
    		$timeleft = $starttime+round($dt_duration/1000)-$curtime;
     		$secsRemain = (round($dt_duration / 1000)-($curtime-$starttime));
     		
     		//build array to return via getXMLHTTPRequest object - you can include more vars but remeber to handle them
     		//correcty in the useHttpResponse function 		
     		$Aj_array = $dt_duration . '|' . $secsRemain . '|' . $title . '|' . $artist .'|' . $album .'|' . $picture .'|' . $lyrics .'|' . $ID;
     		
     		//we are using the text response object  - which i think is easier for small data return
     		//just echo the array                 - not so much AJAX rather AJA ??
     		echo $Aj_array
    
    ?>

That returns this.... [http://bangalorechristianradio.com/PHP/web/aj.php][1]

2.... Using the above data, i use this script to gather the data.......

    <script language="JavaScript">
    
    	var http = getXMLHTTPRequest();
    	var counter;
    
          function getXMLHTTPRequest() {
          try {
          req = new XMLHttpRequest();
          } catch(err1) {
            try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (err2) {
              try {
              req = new ActiveXObject("Microsoft.XMLHTTP");
              } catch (err3) {
                req = false;
              }
            }
          }
          return req;
          }
    
    
    
          function getServerText() {
            var myurl = 'http://bangalorechristianradio.com/PHP/web/aj.php';
            myRand = parseInt(Math.random()*999999999999999);
            var modurl = myurl+"?rand="+myRand;
            http.open("GET", modurl, true);
            http.onreadystatechange = useHttpResponse;
            http.send(null);
          }
    
          function useHttpResponse() {
                   if (http.readyState == 4) {
              if(http.status == 200) {
              	var aj_results = http.responseText.split("|");
    
              	var aj_duration = aj_results[0];
              	var aj_secsremaining = aj_results[1];
              	var aj_title = aj_results[2];
              	var aj_artist = aj_results[3];
    			var aj_album = aj_results[4];
    			var aj_picture = aj_results[5];
    			var aj_lyrics = aj_results[6];
    			var aj_ID = aj_results[7];
    
              	// update title and artist divs
    
              	document.getElementById('title').innerHTML =  aj_title;
              	document.getElementById('artist').innerHTML =  aj_artist;
    			document.getElementById('album').innerHTML =  aj_album;
    			document.getElementById('picture').innerHTML = "<img src=http://chennaichristianradio.com/images/album_art/" + aj_results[5] +" width='142' height='142'>"
    			document.getElementById('lyrics').innerHTML =  aj_lyrics;
    
                countDownInterval = aj_secsremaining - 0;
                countDownTime = countDownInterval + 1;
                countDown()
              }
            } else {
            //document. getElementById('actual').innerHTML = "";
            }
          }
    
    
    
    
        function countDown() {
          countDownTime--;
          if (countDownTime == 0) {
            countDownTime = countDownInterval;
            getServerText()
          }
          else if (countDownTime < 0)
            countDownTime = 30;
          if (document.all)
            document.all.countDownText.innerText = secsToMins(countDownTime);
          else if (document.getElementById)
            document.getElementById("countDownText").innerHTML = secsToMins(countDownTime);
          stopCountDown();
          counter = setTimeout("countDown()", 1000);
        }
    
        function secsToMins(theValue) {
          var theMin = Math.floor(theValue / 60);
          var theSec = (theValue % 60);
          if (theSec < 10)
            theSec = "0" + theSec;
          return(theMin + ":" + theSec);
        }
    
    	function stopCountDown()
    		{
    		clearTimeout(counter)
    		}
    
    
    
    
    
    </script>

Which gives me something like this......
[http://bangalorechristianradio.com/PHP/web/songinfo.html][2]

3.... I need to take the data pulled from the above scripts and place it in my meta tags for facebook and search engines 


Please help me with a script that will place the Title from the song and artist from the song to go to the og:title. Add the ID to the og:url using the format content="http://bangalorechristianradio.com/PHP/web/songinfo.php?songID= (Song ID), and the picture from the Song Album to get added to og:image. 


Thank you, -Bob Swaggerty


  [1]: http://bangalorechristianradio.com/PHP/web/aj.php
  [2]: http://bangalorechristianradio.com/PHP/web/songinfo.html