这是我所做的......我想在输入字段被填满后显示图像第一个字段正在工作现在如何添加额外的输入字段以在该输入字段上显示该特定图像欢迎建议..... HTML代码
$(document).ready(function() {
$("#username").blur(function() { // when focus out
//$("#message").html(''); //before AJAX response
var form_data = {
action: 'last_name',
username: $(this).val()
};
$.ajax({
type: "POST",
url: "functions.php",
data: form_data,
success: function(result) {
$("#lastnamefirstname").html(result);
}
});
});
});
<div id="lastnamefirstname"></div>
<input id="username" name="lname" required="required" class="text" placeholder="Last Name"/>
函数.php
$action = $_POST['action'];
if($action == 'last_name')
{
$firstnamelast = $_POST['username'];
if($firstnamelast!='')
{
last_name($firstnamelast);
}
}
function last_name($firstnamelast)
{
echo ' <img src="images/profile/name.png" style="margin: 1px 0 -28px -37px;"/>';
}