创建js对象

来源:互联网 发布:淘宝网店运营方案设计 编辑:程序博客网 时间:2024/06/05 05:29

贴一段代码:

定义:

/** * 封装实体 *carOwnerMobile *carLicenseNo *repairState */function RepairCar(carOwnerMobile,carLicenseNo,repairState){  this.carOwnerMobile=carOwnerMobile;  this.carLicenseNo=carLicenseNo;  this.repairState=repairState;}

 

调用:

function doAdd(){var carOwnerMobile=$('#carOwnerMobile').val();var carLicenseNo=$('#carLicenseNo').val();var repairState=$('#repairState').val();if(validateRegular()){var repairCar=new RepairCar(carOwnerMobile,carLicenseNo,repairState);//拼凑URL请求地址var url = "saveRepairCarInfo.msp?repairCar=" + repairCar ;function showMessage(data){if("N"==data.loginFlag){alert(data.message);document.location.href="login.html";return;}alert(data.message);document.location.href="getRepairCarInfoListByPage.msp";    };  ajaxRequestWithObjParam(url,showMessage,repairCar);}       }


 

原创粉丝点击