每当我第二次单击"#print"按钮时,第一次单击的值将在实际值之前打印出来.
例如:我第一次点击按钮.警告框打印出正确的值('test1').
我第二次点击按钮.警报框打印出第一个值('test1'),然后我按OK,然后在此之后,警告框打印出第二个值('test2').
我有什么想法吗?
$(".ipdate").focus(function() {
/*$('.dateBox').hide();*/
var tit = $(this).attr('id');
/*var full = '#'+tit+'B';*/
$('#dateBox').show();
$('#print').on('click', function(){
var bottle = $('.sday').val()+' '+$('.smon').val()+' '+$('.syear').val();
$('#'+tit).val(bottle);
alert(tit);
});
$('#close').on('click',function() {
$('#dateBox').hide();
});
});
Run Code Online (Sandbox Code Playgroud) 任何人都可以帮我修复这个MySQL查询吗?我无法弄清楚我做错了什么.
for ($i=1;$i<=12;$i++) {
mysql_query(UPDATE bbank SET created=NOW() + INTERVAL $i MINUTES WHERE bankID='$i' );
}
Run Code Online (Sandbox Code Playgroud)
错误:
解析错误:语法错误,第19行E:\ stuff\www\test\roger.php中的意外T_STRING
我试过添加括号,引号等...
如何将文本输出到父<div>级<span>?我究竟做错了什么?如果有比使用 span 和 更好的解决方案.parent(),请告诉我。
HTML:
<div>
<span></span> <!--the span where i want to output "troll" and "dwarf"-->
<a href="#" class="heroes" alt="troll">Icon</a>
<a href="#" class="heroes" alt="dwarf">Icon</a>
</div>
<div>
<span></span <!--the span where i want to output "witch"-->
><a href="#" class="heroes" alt="witch">Icon</a>
</div>
<div>
<span></span> <!--etc...-->
<a href="#" class="heroes" alt="barbarian">Icon</a>
</div>
<div>
<span></span>
<a href="#" class="heroes" alt="necromancer">Icon</a>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$('.heroes').hover(function() {
var hero = $(this).attr('alt');
$(this).parent('span').text(hero);
}, function() {
$(this).parent('span').text("");
});
Run Code Online (Sandbox Code Playgroud)
谢谢
我在收集从数据库中获取的数据时遇到了一些问题.不知道如何继续.
到目前为止我做了什么:
JQ:
$(document).ready(function(){
$('#submit').click(function(){
var white = $('#white').val();
$.ajax({
type:"POST",
url:"page.php",
data:{white:white}
});
});
});
Run Code Online (Sandbox Code Playgroud)
PHP(请求的page.php)到目前为止:
$thing = mysql_real_escape_string($_POST["white"]);
..database connect stuff..
$query = "SELECT * FROM table1 WHERE parameter='$thing'";
if($row = mysql_query($query)) {
while (mysql_fetch_array($row)) {
$data[]=$row['data'];
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道的是,如何发送数据并使用ajax接收它.
请求不成功时错误怎么办?
对数据库注入的ajax调用有多安全?
谢谢 :)