weixin_33724659 2015-04-24 19:24 采纳率: 0%
浏览 16

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

  • 写回答

3条回答 默认 最新

  • weixin_33695082 2015-04-24 19:25
    关注

    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");
    
    评论

报告相同问题?