简体   繁体   English

将变量放入get请求数据中

[英]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. 我有一个jQuery get请求,我需要在数据中放入一个变量来检索正确的信息,因为它依赖于其他东西。

Here's my jQuery; 这是我的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 我需要将歌曲放入第二个get请求中的数据,但不知道如何执行此操作

In your second GET request you are sending along an object, you need to send a string. 在您发送第二个GET请求时,您需要发送一个字符串。

By sending the object the code will automatically do a song.toString(), which most likely results in the "[object Object]" string being actually sent. 通过发送对象,代码将自动执行song.toString(),这很可能导致实际发送“[object Object]”字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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