+ -
当前位置:首页 → 问答吧 → getJSON的问题

getJSON的问题

时间:2009-03-26

来源:互联网

我用getjson写无刷新的数据验证,就是看用户名活数据是否有相同记录,
现在问题是这样,在页面新添加一个比如添加一个aaa,提交进数据库以后,返回来继续再添加,然后再输入aaa,jquery代码好像没有执行,直接给判断出aaa是没有相同的记录,请问这是什么问题,
代码如下
jquery:
$('#stypeName').blur(function() {
if ($('#stypeName').val() == "") {
$('#error').html('请填写区域名称!');
}
else {
var keyName = $('#stypeName').val();
$.getJSON(
'/SysConfig/ShoolTypeCheckName/',
{ name: keyName },
function(data) {
alert(data);
if (data != true) {
$('#submit').removeAttr("disabled");
$('#error').html('名称不重复,可以添加!');
}
else {
$('#submit').attr("disabled", "true");
$('#error').html('名称重复,不可添加!');
}
}
);
}
});
cs代码:
public ActionResult ShoolTypeCheckName(string name)
{
try
{
System.Threading.Thread.Sleep(500);
bool IsBeing = false;
if (!String.IsNullOrEmpty(name))
{
IShoolType Is = ServiceBulier.BuilderShoolType();
IsBeing = Is.CheckName(name);
}
return this.Json(IsBeing);
}
catch (Exception ex)
{
return RedirectToAction("Warning", "Home", new { message = ex.Message, ActionName = "ShoolTypeConfig", controll = "SysConfig" });
}
}
知道的大哥给个解释~!

作者: baiye640   发布时间: 2009-03-26

时间戳没有加 String.ValueOf(new Date())

作者: fordybeach   发布时间: 2009-03-26