-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickenquiry.js
92 lines (74 loc) · 1.95 KB
/
quickenquiry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
$(function()
{
$("#btn2").click(function()
{
var status = true;
var name = $("#name").val().trim();
if(name=="")
{
status = false;
$("#name").css({"border":"1px solid red"});
$("#nameerror").html("Please enter name");
}
else
{
$("#name").css({"border":""});
$("#nameerror").html("");
}
var email = $("#email").val().trim();
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if((email=="")||(!email.match(mailformat)))
{
status = false;
$("#email").css({"border":"1px solid red"});
$("#emailerror").html("Please enter email");
}
else
{
$("#email").css({"border":""});
$("#emailerror").html("");
}
var mobile = $("#mobile").val().trim();
if(mobile=="")
{
status = false;
$("#mobile").css({"border":"1px solid red"});
$("#mobileerror").html("Please enter mobile");
}
else
{
$("#mobile").css({"border":""});
$("#mobileerror").html("");
}
var message = $("#message").val().trim();
if(message=="")
{
status = false;
$("#message").css({"border":"1px solid red"});
$("#messageerror").html("Please enter Message");
}
else
{
$("#message").css({"border":""});
$("#messageerror").html("");
}
if(status==true)
{
var mydata = {"name":name, "email":email,"mobile":mobile,"message":message};
$.ajax({
type:"POST",
url:"savequickenquiry.php",
data:mydata,
success:function(response)
{
$("#name").val("");
$("#email").val("");
$("#mobile").val("");
$("#message").val("");
$("#showmsg").html(response);
}
});
}
return status;
});
});