function 里如何使用 if 语句
function robinTest(type){
swal({
title: "通道测试",
text: "请输入要测试支付的金额"
+"回调url",showCancelButton: true,
html: true,
confirmButtonText: "确认测试" ,
type: "prompt",
}, function(){
window.open('<?php echo url::s("index/service/robinTest");?>' + '?amount=' + $('#amount').val() + '&callback_url=' + $('#callback_url').val() + "&type=" + type);
----> 这里amount 是 我要提交的金额,我想加一个if语句在这里
----> 如果amount 金额是300, "&type=" + type 就变成"&type=" + 10 ,这样固定他的type类型
----> 如果amonut 金额是其他数字 "&type=" + type 就变成"&type=" + 15
----> 不知道if语句加哪里,自己尝试了结果导致这个提交框都打不开
----> 下面代码可以不用管
location.href='';
})
$('.showSweetAlert fieldset input').attr('type','hidden');
$('#amount').val('1.00');
$('#callback_url').val('<?php echo URL_ROOT; ?>/index/index/callback.do');
}
var amount = $('#amount').val();
// ----> 如果amount 金额是300, "&type=" + type 就变成"&type=" + 10 ,这样固定他的type类型
// ----> 如果amonut 金额是其他数字 "&type=" + type 就变成"&type=" + 15
var type = amount == 300 ? 10 : 15;
window.open('<?php echo url:: s("index/service/robinTest");?>?amount=' + amount + '&callback_url=' + $('#callback_url').val() + '&type=' + type);
// ----> 下面代码可以不用管
// location.href='';
// })