在jQuery中.我正在按班级调用一个事件.你如何在Prototype中做同样的事情.
$(".button").click(function() {
var element = $(this);
var Id = element.attr("id");
});
Run Code Online (Sandbox Code Playgroud) 我正在使用这种方法.如果sql中存在错误,则仅对asset_group的第一个id进行回滚.其余的ID被忽略.我是以正确的方式做到的吗?
my $sql = "sql batch that update and insert depending on the condition";
$dbh->{RaiseError} = 1;
$dbh->{PrintError} = 0;
$dbh->{AutoCommit} = 0;
my $sth = $dbh->prepare($sql);
my @error = ();
my $num = 0;
foreach my $id (@asset_group) {
next if ($id eq '');
eval {
$sth->bind_param(1, $id);
$sth->bind_param(2, $vars{'other_id'});
$sth->execute();
};
if ($@) {
$dbh->rollback();
push @error, $@
} else {
$dbh->commit();
}
}
Run Code Online (Sandbox Code Playgroud)