一些js

1.json对象的写法

var obj = {};
    obj.SystemCode = code;
    obj.pageIndex = pageIndex;
$.post(url, obj,function (result) {
                );
        });

传给后台的json数据是

{“SystemCode”:"code","pageIndex":“pageIndex”}

如果传入的见其值为空数据为

{“SystemCode”:null}的形式
//将字符串"null"或null转换为""
function checkNull(temp) {
    if (temp == null)
        temp= "";
    if (temp.toString().toLowerCase() == "null")
        temp = "";
    return temp;
}
posted @ 2015-06-30 22:40  草旅虫  阅读(119)  评论(0编辑  收藏  举报