ajax 创建对象验证

时间:2022-09-29 07:59:41

function getValue(){
var str = $("#selectid option:selected").val(); //获得选中的值
var num = $("input[name='num']").val();
var pwd = $("input[name='pwd']").val();
var jr = parseFloat($("#x-money-jr").html());
var dd = parseFloat($("#x-money-dd").html());
$.ajax({
type:"post",
dataType:"html",
url:"index.php?ctl=le&act=cutm",
data:{'met':str,'num':num,'pwd':pwd},
success:function(msg){
if(msg){
var x_msg = {
1:'交易密码错误',
0:'转出途径未确认',
2:'请输入正确的金额',
3:'交易金额溢出',
5:'交易成功'
};
alert(x_msg[msg]);
if(msg==5){
if(str==1){
$("#x-money-jr").html(jr-parseFloat(num));
$("#x-money-dd").html(dd+parseFloat(num));
}
if(str==2){
$("#x-money-jr").html(jr+parseFloat(num));
$("#x-money-dd").html(dd-parseFloat(num));
}
}
}
}
});
}