提交 88b2183e 编写于 作者: E edisonxiang

addajaxinvoke

上级 8e7f5c70
...@@ -93,7 +93,7 @@ Please select one applicable statement from the following and fill in the blanks ...@@ -93,7 +93,7 @@ Please select one applicable statement from the following and fill in the blanks
Fax: Fax:
</td> </td>
<td> <td>
<input type="text" id="individual-Fax" /> <input type="text" id="individual-fax" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -170,7 +170,7 @@ Please select one applicable statement from the following and fill in the blanks ...@@ -170,7 +170,7 @@ Please select one applicable statement from the following and fill in the blanks
Fax: Fax:
</td> </td>
<td> <td>
<input type="text" id="legalentity-Fax" /> <input type="text" id="legalentity-fax" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -183,7 +183,7 @@ Please select one applicable statement from the following and fill in the blanks ...@@ -183,7 +183,7 @@ Please select one applicable statement from the following and fill in the blanks
<table id="cla-table"> <table id="cla-table">
<tr> <tr>
<td> <td>
<a href="#" id="sign-cla-button" class="btn btn-template-main"> <a href="#" id="sign-cla-button" class="btn btn-template-main" posturl="http://159.138.129.162:8888/cla">
Sign Sign
</a> </a>
<a href="#" id="reset-cla-button" class="btn btn-template-main"> <a href="#" id="reset-cla-button" class="btn btn-template-main">
......
...@@ -96,7 +96,7 @@ title = "签署CLA" ...@@ -96,7 +96,7 @@ title = "签署CLA"
传真: 传真:
</td> </td>
<td> <td>
<input type="text" id="individual-Fax" /> <input type="text" id="individual-fax" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -173,7 +173,7 @@ title = "签署CLA" ...@@ -173,7 +173,7 @@ title = "签署CLA"
传真: 传真:
</td> </td>
<td> <td>
<input type="text" id="legalentity-Fax" /> <input type="text" id="legalentity-fax" />
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -186,7 +186,7 @@ title = "签署CLA" ...@@ -186,7 +186,7 @@ title = "签署CLA"
<table id="cla-table"> <table id="cla-table">
<tr> <tr>
<td> <td>
<a href="#" id="sign-cla-button" class="btn btn-template-main"> <a href="#" id="sign-cla-button" class="btn btn-template-main" posturl="http://159.138.129.162:8888/cla">
签署 签署
</a> </a>
<a href="#" id="reset-cla-button" class="btn btn-template-main"> <a href="#" id="reset-cla-button" class="btn btn-template-main">
......
...@@ -59,7 +59,7 @@ function initClaPage() { ...@@ -59,7 +59,7 @@ function initClaPage() {
var checkpass = true; var checkpass = true;
$("input[type=text]", "#individual-table").each(function (i) { $("input[type=text]", "#individual-table").each(function (i) {
if ($(this).hasClass("require")) { if ($(this).hasClass("require")) {
if ($(this).val() == "") { if ($.trim($(this).val()) == "") {
checkpass = false; checkpass = false;
return false; return false;
} }
...@@ -74,7 +74,7 @@ function initClaPage() { ...@@ -74,7 +74,7 @@ function initClaPage() {
} }
return false; return false;
} }
var email = $('#individual-email').val(); var email = $.trim($('#individual-email').val());
if (!regemail.test(email)) { if (!regemail.test(email)) {
if (lang == "zh-cn") { if (lang == "zh-cn") {
$('#tip-cla-label').html("邮箱格式不正确!"); $('#tip-cla-label').html("邮箱格式不正确!");
...@@ -83,7 +83,7 @@ function initClaPage() { ...@@ -83,7 +83,7 @@ function initClaPage() {
} }
return false; return false;
} }
var telephone = $('#individual-telephone').val(); var telephone = $.trim($('#individual-telephone').val());
if ((!regphone.test(telephone)) && (!regmobile.test(telephone))) { if ((!regphone.test(telephone)) && (!regmobile.test(telephone))) {
if (lang == "zh-cn") { if (lang == "zh-cn") {
$('#tip-cla-label').html("电话格式不正确!"); $('#tip-cla-label').html("电话格式不正确!");
...@@ -97,7 +97,7 @@ function initClaPage() { ...@@ -97,7 +97,7 @@ function initClaPage() {
var checkpass = true; var checkpass = true;
$("input[type=text]", "#legalentity-table").each(function (i) { $("input[type=text]", "#legalentity-table").each(function (i) {
if ($(this).hasClass("require")) { if ($(this).hasClass("require")) {
if ($(this).val() == "") { if ($.trim($(this).val()) == "") {
checkpass = false; checkpass = false;
return false; return false;
} }
...@@ -112,7 +112,7 @@ function initClaPage() { ...@@ -112,7 +112,7 @@ function initClaPage() {
} }
return false; return false;
} }
var email = $('#legalentity-email').val(); var email = $.trim($('#legalentity-email').val());
if (!regemail.test(email)) { if (!regemail.test(email)) {
if (lang == "zh-cn") { if (lang == "zh-cn") {
$('#tip-cla-label').html("邮箱格式不正确!"); $('#tip-cla-label').html("邮箱格式不正确!");
...@@ -121,16 +121,64 @@ function initClaPage() { ...@@ -121,16 +121,64 @@ function initClaPage() {
} }
return false; return false;
} }
var telephone = $('#legalentity-telephone').val(); var telephone = $.trim($('#legalentity-telephone').val());
if ((!regphone.test(telephone)) && (!regmobile.test(telephone))) { if ((!regphone.test(telephone)) && (!regmobile.test(telephone))) {
if (lang == "zh-cn") { if (lang == "zh-cn") {
$('#tip-cla-label').html("电话格式不正确!"); $('#tip-cla-label').html("电话格式不正确!");
} else { } else {
$('#tip-cla-label').html("Telephone format is incorrent!"); $('#tip-cla-label').html("Telephone format is incorrent!");
} }
return false;
} }
} }
// build json
var posturl = $(this).attr("posturl");
var jsonData = {};
if (v == 0) {
// individual
jsonData = {
"type": v,
"name": $.trim($('#individual-name').val()),
"address": $.trim($('#individual-address').val()),
"date": $.trim($('#individual-date').val()),
"email": $.trim($('#individual-email').val()),
"telephone": $.trim($('#individual-telephone').val()),
"fax": $.trim($('#individual-fax').val()),
};
} else {
// legalentity
jsonData = {
"type": v,
"name": $.trim($('#legalentity-name').val()),
// only for legalentity
"title": $.trim($('#legalentity-title').val()),
// only for legalentity
"corporation": $.trim($('#legalentity-corporation').val()),
"address": $.trim($('#legalentity-address').val()),
"date": $.trim($('#legalentity-date').val()),
"email": $.trim($('#legalentity-email').val()),
"telephone": $.trim($('#legalentity-telephone').val()),
"fax": $.trim($('#legalentity-fax').val()),
};
}
// send request
$.ajax({
type: "POST",
url: posturl,
data: JSON.stringify(jsonData),
contentType: "application/json; charset=utf-8",
crossDomain: true,
datatype: "json",
success: function (data) {
alert(data);
},
error: function () {
alert("请求失败");
}
});
return false; return false;
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册