AJAX网址中的变量

How can I use a variable within an AJAX call URL?

So far I have the following:

id = $(this).children('span.title').attr('data-id');

$("#test").load("http://localhost:8888/projects/superfreerespo/ + id/ .gameBox-Ops");

There is something wrong with the way I have declared the url but being relatively knew to Ajax I am a little unsure where I am going wrong.

Just to point out the .gameBox-Ops is not part of the URL, it is the class of the container I am trying to call with AJAX

id is a variable, you have to escape the string to concatenate it into it.

$("#test").load("http://localhost:8888/projects/superfreerespo/"+id"+/ .gameBox-Ops");
$("#test").load("http://localhost:8888/projects/superfreerespo/" + id + "/ .gameBox-Ops");

Not related to AJAX, your string concatenation is wrong.

Use proper string concatenation. Also I am not sure why you have . on last part.

id = $(this).children('span.title').attr('data-id');
$("#test").load("http://localhost:8888/projects/superfreerespo/" + id + "/.gameBox-Ops");