写手在作画的夜晚,留下路人惊叹
和大家分享一下一个表单提交的小案例
好啦,就在这里了下面赋上代码
function toSubmit() {
var source
var isMobile = /Android|webOs|iPhone|iPad|BlackBerry/i.test(navigator.userAgent)
if (isMobile) {
source = 2
} else {
source = 1
}
var name = $("#card_name").val()
var phoneNumber = $("#card_name1").val()
var investRegion = $("#card_name3").val()
console.log(source)
$.ajax({
type: "POST",
url: "/addPotentialInvestor",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify({
"name": name,
"phoneNumber": phoneNumber,
"investRegion": investRegion,
"source": source.toString()
}),
success: function(res) {
console.log(res)
$("#card_name").val("")
$("#card_name1").val("")
$("#card_name3").val("")
},
error: function(err) {
console.log(err, "失败")
}
})
setTimeout('$(".titleConBackground").fadeIn()', 300);
setTimeout('$(".titleConBackground").fadeOut()', 1200);
}
来源:https://www.cnblogs.com/home-/p/11579771.html