@ -53,7 +53,7 @@
< div class = "col-xs-12 col-sm-12 col-md-12 wrap" >
<!-- form -->
< form id = "my form" name = "my form" class = "form-horizontal wow fadeInDown" >
< form id = "form" name = "form" class = "form-horizontal wow fadeInDown" >
< div class = "form-group" >
< label for = "title" class = "col-sm-3 control-label left" > 融资公司:< / label >
< div class = "col-sm-6" >
@ -105,19 +105,22 @@
< div class = "form-group" >
< label for = "code" class = "col-xs-12 col-sm-3 control-label left" > 上传商业计划书:< / label >
< div class = "col-xs-7 col-sm-4 pic-show" >
< input type = "text" name = "prospectus" class = "form-control right" id = "prospectus" placeholder = "" >
< / div >
< div class = "col-xs-4 col-sm-4 col-md-2 pic-pic" >
< button class = "btn btn-danger page-btn" > 上传< / button >
<!-- <div class="col - xs - 7 col - sm - 4 pic - show"> -->
<!-- <input type="text" name="prospectus" class="form - control right" id="prospectus" placeholder=""> -->
<!-- </div> -->
<!-- <div class="col - xs - 4 col - sm - 4 col - md - 2 pic - pic"> -->
<!-- <button class="btn btn - danger page - btn">上传</button> -->
<!-- <button class="">上传</button> -->
< input type = "file" name = "prospectus" >
<!-- </div> -->
< / div >
< div class = "form-group" >
< div class = "col-sm-offset-4 col-sm-12 sub" >
< input class = "button" type = "button" onclick = "apply()" value = "提交申请" >
< / div >
< / div >
< / form >
< div class = "form-group" >
< div class = "col-sm-offset-4 col-sm-12 sub" >
< button type = "submit" name = "button" value = "提交申请" id = "submit" class = "btn btn-danger page-btn" > 提交申请< / button >
< / div >
< / div >
< / div >
@ -133,82 +136,70 @@
< SCRIPT language = javaScript >
$('body').on('click','#submit',function(){
var company = $('#company').val();
var address = $('#address').val();
var phone = $('#phone').val();
var cz = $('#cz').val();
var email = $('#email').val();
var name = $('#name').val();
var cate = $('#cate').val();
var prospectus = $('#prospectus').val();
function apply(){
var formData = new FormData(document.querySelector("#form"));
$.ajax({
type: 'post',
dataType: 'text',
// dataType: 'text',
// dataType: 'json',
url: 'https://suzhou.njrenzhou.cn/api.php/apply/apply',
data: {
'company': company,
'address': address,
'phone': phone,
'cz': cz,
'email': email,
'name': name,
'cate': cate,
'prospectus': prospectus
},
beforeSend:function(){
if (!company) {
alert('融资公司不能为空');
return false;
}
else if (address == '') {
alert('地址不能为空');
return false;
}
else if (phone == '') {
alert('手机号码不能为空');
return false;
}
else if(!phone.match(/^1(3|4|5|8)\d{1}[-]?\d{4}[-]?\d{4}$/)){
alert('手机号码格式错误');
return false;
}
else if (cz == '') {
alert('传真不能为空');
return false;
}
else if (email == '') {
alert('邮箱不能为空');
return false;
}
else if (name == '') {
alert('姓名不能为空');
return false;
}
else if (cate == '') {
alert('行业分类不能为空');
return false;
}
else if (prospectus == '') {
alert('商业计划书不能为空');
return false;
}
else return true;
},
success:function(data){
console.log(data);
if (data.msg = 'success') {
data: formData,
processData: false, // 不处理数据
contentType: false, // 不设置内容类型
// beforeSend:function(){
// if (!company) {
// alert('融资公司不能为空');
// return false;
// }
// else if (address == '') {
// alert('地址不能为空');
// return false;
// }
// else if (phone == '') {
// alert('手机号码不能为空');
// return false;
// }
// else if(!phone.match(/^1(3|4|5|8)\d{1}[-]?\d{4}[-]?\d{4}$/)){
// alert('手机号码格式错误');
// return false;
// }
// else if (cz == '') {
// alert('传真不能为空');
// return false;
// }
// else if (email == '') {
// alert('邮箱不能为空');
// return false;
// }
// else if (name == '') {
// alert('姓名不能为空');
// return false;
// }
// else if (cate == '') {
// alert('行业分类不能为空');
// return false;
// }
// else if (prospectus == '') {
// alert('商业计划书不能为空');
// return false;
// }
// else return true;
// },
success:function(res){
console.log(res);
if (res.code == 200) {
alert('提交成功');
window.location.reload();
}else{
alert('提交失败' );
alert(res.msg);
}
},
error:function(){
alert('error');
}
})
})
}
< / SCRIPT >