<script language="javascript" src="<?php echo base_url();?>js/jquery.js"></script>
<script language="javascript">
$(document).ready(function(){
$('input,textarea').live("blur",function(){
var ajax_id = $(this).attr('name'); // 获取文本框的名称
var arg = {};
var arg1 = ajax_id;
var value1 = $(this).val();
arg[arg1] = value1; //提交POST
$.post("/" + ajax_id,arg,
function(data,status){
if(data == "")
{
//$("#" + ajax_id).parent().find('span').css('color','green'); //显示错误信息
$("#" + ajax_id).parent().find('span').text(" * ");
}
else
{
//$("#" + ajax_id).find('span').css('color','red');
$("#" + ajax_id).parent().find('span').text(' * ' + data);
}
});
});
});
</script>