有没有办法在html()被触发后启动一个事件?如:
$.post("ajax.php", {data :data}, function(data){
$("#countries").html(data, function(){
alert("test");
});
});
Run Code Online (Sandbox Code Playgroud)
这不起作用.
编辑:我问这个是因为我想做一些事情(另一个电话)来自呼叫的信息...我想简化示例...我想程序员总是想知道为什么...
所以这里是更新的例子
$.post("ajax.php", {data :data}, function(data){
$("#countries").html(data, function(){
var id = $("#countries option:selected").attr("id");
getRegions(id);
});
});
Run Code Online (Sandbox Code Playgroud) 我在debian虚拟盒中安装了selenium-server-standalone-2.42.2.jar
并安装了Firefox 29.0
并尝试使用phpunit运行以下脚本,phpunit是目录中唯一的文件:
<?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{
public function setUp()
{
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowser('firefox');
$this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
}
public function testHasLoginForm()
{
$this->url('index.php');
$username = $this->byName('username');
$password = $this->byName('password');
$this->assertEquals('', $username->value());
$this->assertEquals('', $password->value());
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
1) TestLogin::testHasLoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to connect to host
127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
Run Code Online (Sandbox Code Playgroud)
这是什么意思?
我已经多了几个线程,显然我必须做以下尝试:
1)在命令shell中键入它
export PATH=:0;
Run Code Online (Sandbox Code Playgroud)
结果:我得到了同样的错误.
2)我已经安装了vnc4server并将debian-vm:1作为应用程序然后设置export PATH=debian-vm:1运行它与realvnc并在查看器(这工作)我遇到了同样的问题.
鉴于下表:
id column1 column2
-------------------------
1 3 8
2 4 7
3 4 10
4 4 14
5 14 17
6 10 27
7 14 21
8 16 14
9 21 4
10 30 3
Run Code Online (Sandbox Code Playgroud)
当选择数字4和14时查询选择行的最佳方法是什么,column1或者column2当数字4和数字14都在行中时排除.请注意,订单可以撤消.
预期产出
id column1 column2
-------------------------
2 4 7
3 4 10
5 14 17
7 14 21
8 16 14
9 21 4
Run Code Online (Sandbox Code Playgroud) 如何在PHP中动态显示最后一个数组中的元素.例如:
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 8 [category_path] => Computers))
Run Code Online (Sandbox Code Playgroud)
为了从最后一个数组返回"id"
8
Run Code Online (Sandbox Code Playgroud)
并为下一个例子
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 5 [category_path] => Computers)
[2] => Array ( [id] => 16 [user_id] => 45 [category_path] => Soft))
Run Code Online (Sandbox Code Playgroud)
为了回归
16
Run Code Online (Sandbox Code Playgroud)
谢谢!
一个要启动的功能让我们说用户输入完最后一个类型后的第二个半.我有这段代码,但每次用户创建一种类型时,我都不需要启动脚本:
$(document).ready(function()
{
var $firstname = $("#firstname");
$firstname.keyup(function()
{
var content = $("#firstname").val();
$.post("ajax.php", { firstname: content}, function(result){
var contentDiv = $("#ContainerValidation");
contentDiv.fadeOut(400, function(){ contentDiv.html(result); });
contentDiv.fadeIn(400);
contentDiv.fadeOut(5000);
});
});
});
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.
给定以下SQL表:
管理员:
id Name rating
1 Jeff 48
2 Albert 55
3 Ken 35
4 France 56
5 Samantha 52
6 Jeff 50
Run Code Online (Sandbox Code Playgroud)
会议:
id originatorid Assitantid
1 3 5
2 6 3
3 1 2
4 6 4
Run Code Online (Sandbox Code Playgroud)
我想根据Ken的观点(id = 3)生成一个表,因此他的id可能出现在会议表中的两个不同列中.(由于我引入了两个不同的字段列,因此语句IN不起作用).
因此输出将是:
id originatorid Assitantid
1 3 5
2 6 3
Run Code Online (Sandbox Code Playgroud)