The variable x is getting the current url. I need to then put this url into the spot where the xxxx is. How would I go about doing this?
<script type='text/javascript'>
function postListen()
{
var x = ( document.URL );
FB.api(
'/me/beatmushroom:listen',
'post',
{ song: xxxx},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Listen was successful! Action ID: ' + response.id);
}
});
}
Simply use the variable in the object literal. While the key is always a string (even without quotes), the value can be any JavaScript epxression: