如何将var添加到文本javascript中 [英] How add var to text javascript

查看:131
本文介绍了如何将var添加到文本javascript中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码

$.ajax({
   url: 'http://localhost/record/FlashWavRecorder-master/jjj/r/',
   type: 'HEAD',
   error: function () {
       $('.sd').html('<img src="5-0.gif" />');
   },
   success: function () {
       bo = 'a';
       $('.sd').html('<span style="color:#99CC00; font-weight:bold;">done</span> ');
   }
});

我想在这部分代码中添加varible

I want to add varible to this part of code

url:'http://localhost/record/FlashWavRecorder-master/jjj/r/+var',


推荐答案

只需附加如下变量:

url:'http://localhost/record/FlashWavRecorder-master/jjj/r/'+var,

附注:

不要尝试使用 var 作为变量名。这是不可能的,因为 var 是一个保留关键字。

(但我确定这只是为了说明这个例子)

Side-note:
Don't try to use use var as your variable name. That's not possible since var is a reserved keyword.
(But I'm sure this is just to illustrate the example)

这篇关于如何将var添加到文本javascript中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆