Javascript Jquery点击自动化有延迟吗?
我试图创建一个jquery脚本,当选中复选框并单击“自动发送”按钮时,它会单击类中的所有元素(带有delay-setTimeout),但有一点出错了,它不起作用:( 以下是我的代码HTML/PHP代码:Javascript Jquery点击自动化有延迟吗?,javascript,php,jquery,automation,click,Javascript,Php,Jquery,Automation,Click,我试图创建一个jquery脚本,当选中复选框并单击“自动发送”按钮时,它会单击类中的所有元素(带有delay-setTimeout),但有一点出错了,它不起作用:( 以下是我的代码HTML/PHP代码: <td class="send_div"> <a class="meilsend" href ="smtp/send.php?name='.$result['name'].'&ref='.$result['refnummer'].'&invoice_nu
<td class="send_div">
<a class="meilsend" href ="smtp/send.php?name='.$result['name'].'&ref='.$result['refnummer'].'&invoice_number='.$result['invoice_number'].'&insurance='.$result['insurance'].'">Send mail</a>
<a class="fastsend" href="#" style="display: none;">Fast mail</a>
<a class="fastsend2" href="smtp/fastsend.php?name='.$result['name'].'&ref='.$result['refnummer'].'&invoice_number='.$result['invoice_number'].'&insurance='.$result['insurance'].'" style="display: none;">Fast mail</a>
</td>
<th>
Send mail
Fast Mode<input id="fastmode" type="checkbox" name="fastmode" value="1">
<span style="display: none; cursor: pointer;" id="automatic">Automatic send</span>
</th>
你调试代码了吗?F12等等。。。 你能格式化你的答案吗(编辑它)…我在试着阅读你代码的第一部分时变瞎了(如果有什么…):P 无论如何,对于Ajax调用,请尝试以下方法:
$.ajax({
url: fasthref,
type: "POST",
contentType: 'application/json',
data: "{ 'fastsend': fastsend}",
dataType: 'json',
success: function (result) {
$('#serachresult').fadeIn();
$('#serachresult').html(data);
}
error: function (ex) {
// DO YOUR STUFF
}
});
“出现问题”-你能解释一下你的错误吗?当我键入$('automatic')。单击(function(){$('.fastssend2')。单击();});在//start和end automatic之间,我没有任何更改,我希望在单击$('automatic')时要触发所有这些,您是否需要延迟单击,因为ajax请求未完成,并且您会遇到一些错误?
$.ajax({
url: fasthref,
type: "POST",
contentType: 'application/json',
data: "{ 'fastsend': fastsend}",
dataType: 'json',
success: function (result) {
$('#serachresult').fadeIn();
$('#serachresult').html(data);
}
error: function (ex) {
// DO YOUR STUFF
}
});