也许你们可以帮我解决这个问题,过去30分钟我一直在努力.
假设我有四个同一类的元素.
<div class="test">hi</div>
<div class="test">hey</div>
<div class="test">yo</div>
<div class="test">What's up</div>
Run Code Online (Sandbox Code Playgroud)
如何选择点击的那个?
我能够让它像这样工作:
$('.test').click(function() {
$(this).toggleClass("btn-danger btn-success");
});
Run Code Online (Sandbox Code Playgroud)
但是,我需要在ajax调用之后没有点击成功而触发它,所以我需要能够做这样的事情(尝试失败):
$('.test', this).toggleClass("btn-danger btn-success"); // This did not work
$(this).find('.test').toggleClass("btn-danger btn-success"); // Also did not work
Run Code Online (Sandbox Code Playgroud)
有什么建议?非常感谢!!
哪个是最快的方法将查询获取到 MYSQL,然后返回到输出:
console.log('查询完成', 结果)"
有没有更好的方法?请解释你的答案!
谢谢!
方法一:
var connection = mysql.createConnection({multipleStatements: true});
connection.query('SELECT ?; SELECT ?', [1, 2], function(err, results) {
if (err) throw err;
console.log('queries done', results);
});
Run Code Online (Sandbox Code Playgroud)
方法二:
const Db = mysql.createPool({
connectionLimit: 7,
dateStrings: true,
multipleStatements: true
});
Db.getConnection(function(err, connection) {
if(err) console.log(err);
connection.query(`
SELECT "1" AS "first";
SELECT "2" AS "second";`, function(err, results) {
connection.release();
if(err) console.log(err);
console.log('queries done', results);
}
);
});
Run Code Online (Sandbox Code Playgroud)
方法三:
const Db = mysql.createPool({
connectionLimit: 7,
dateStrings: true,
multipleStatements: true
});
Db.getConnection(function(err, …Run Code Online (Sandbox Code Playgroud) SQL小提琴:http ://sqlfiddle.com/#!9/ e7f72/2
假设名为 testt 的表中有 10 条记录(id 不是 null 自动增量)。如果我要做
SELECT GROUP_CONCAT(id) FROM testt
Run Code Online (Sandbox Code Playgroud)
我希望结果看起来像
1、2、3、4、5、6、7、8、9、10
我怎么能让结果看起来像这样:
1,2
3,4
5,6
7,8
9,10
我需要你的帮助,我一直无法找到执行此操作的确切方法。
我只想将我的主页发送到一个 proxypass 位置
location / {
proxy_pass http://website;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
Run Code Online (Sandbox Code Playgroud)
然后将所有其他路由(我不知道它们都会是什么,它将是动态的)发送到另一个代理通道。
location /* {
proxy_pass http://interaction;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Run Code Online (Sandbox Code Playgroud)
我知道 * 是错误的(因为它不起作用),但它只是代表 /anything 或 /whatever 或 /idontknowyet
谢谢您的帮助!