简体   繁体   中英

Put a variable in a get requests data

I have a jQuery get request and I need to put a variable in the data to retrieve the right information as it is dependent upon other things.

Here's my jQuery;

 $.get("AJAX/get_latest_track.php",  function(result){
 song = new Audio(result);



 $.get("AJAX/get_player.php", { url: song },function(result){
     $("#loadInfo").html(result);
     });

I need to put the song into the data in the second get request but not sure how to do this

In your second GET request you are sending along an object, you need to send a string.

By sending the object the code will automatically do a song.toString(), which most likely results in the "[object Object]" string being actually sent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM