PageSourceSearch

https://www.adaniports.com/scripts/Ports/PortsContactUsForm.js

js adaniports.com collected 2026-09-24 21:39:14 UTC 7,017 bytes, 163 lines download raw bytes

1$("#btnContactUsSubmit").click(function (e) {
2    getFormSubmit();
3    e.preventDefault();
4});
5
6function getFormSubmit(e) {
7    grecaptcha.ready(function () {
8        grecaptcha.execute('6LfT0SYsAAAAAGlgUYanrDa-KkcEEIo8V4UX9WZV', { action: 'InsertContactdetail' }).then(function (token) {
9            $('.g-recaptcha').val(token);
10            $('#btnContactUsSubmit').attr("disabled", "disabled");
11            var name = $("#cname").val();
12            if (name == "") { alert("Please enter your Name"); $("#cname").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
13            var mailid = $("#cmailid").val();
14            if (mailid == "") { alert("Email is Required"); $("#cmailid").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
15            var messagetype = $("#cmessageType").val();
16            if (messagetype == "") { alert("Please specify your subject to the message"); $("#cmessageType").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
17            var ccontactno = $("#ccontactno").val();
18            if (ccontactno == "") { alert("Please specify your Mobile Number"); $("#ccontactno").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
19
20            if (ccontactno.length != 10) {
21                alert("Contact Number should be of 10 digit"); $("#ccontactno").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false;
22            }
23
24            var message = $("#cmessage").val();
25            if (message == "") { alert("Please enter any message"); $("#cmessage").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
26            var formtype = $("#cFormType").val();
27            var pageinfo = window.location.href;
28            if (!validateEmail(mailid)) { alert("Please enter valid email address"); $("#cmailid").focus(); $('#btnContactUsSubmit').removeAttr("disabled"); return false; }
29
30            function validateEmail(sEmail) {
31                var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
32                if (filter.test(sEmail)) { return true; }
33                else { return false; }
34            }
35
36            var model = {
37
38                Name: name,
39                Mobile: ccontactno,
40                Email: mailid
41            };
42
43            var currentdate = new Date().toISOString().slice(0, 19).replace('T', ' ');
44
45            //create json object
46            var savecustomdata = {
47                Name: name,
48                Email: mailid,
49                MessageType: messagetype,
50                Mobile: ccontactno,
51                Message: message,
52                FormType: formtype,
53                PageInfo: pageinfo,
54                FormSubmitOn: currentdate,
55                reResponse: token
56            };
57
58            //ajax calling to insert  custom data function
59            $.ajax({
60                type: "POST",
61                data: JSON.stringify(savecustomdata),
62                url: "/api/ports/InsertContactdetail",
63                contentType: "application/json",
64                success: function (data) {
65                    if (data.status == "1") {
66                        window.location.href = "/thankyou";
67                    }
68                    else {
69                        alert("Sorry Operation Failed!!! Please try again later");
70                        $('#btnContactUsSubmit').removeAttr("disabled");
71                        return false;
72                    }
73                }
74            });
75            return false;
76
77
78            $.ajax({
79                type: "POST",
80                data: JSON.stringify(model),
81                url: "/api/Ports/CreateOTP",
82                contentType: "application/json",
83                success: function (data) {
84                    if (data.status == "1") {
85                        var otp = prompt("Please enter OTP received on your mobile", "");
86
87                        if (otp != null) {
88
89                            var generatedOtp = {
90                                mobile: mobile,
91                                OTP: otp,
92                            }
93                            $.ajax({
94                                type: "POST",
95                                data: JSON.stringify(generatedOtp),
96                                url: "/api/Ports/VerifyOTP",
97                                contentType: "application/json",
98                                success: function (data) {
99                                    if (data.status == "1") {
100
101
102                                    }
103
104                                    else {
105                                        alert("Invalid OTP");
106                                        $('#btnContactUsSubmit').removeAttr("disabled");
107                                        return false;
108                                    }
109                                }
110                            });
111
112                        }
113                    }
114                    else if (data == "-1") {
115                        alert("Invalid Mobile Number");
116                        $('#btnContactUsSubmit').removeAttr("disabled");
117                    }
118                }
119            });
120
121            return false;
122
123        });
124    });
125}
126
127
128// JS changes countactUs onClick function
129$("#PortAndTerminal").on('change', function () { addressSelection('PortAndTerminal') });
130$("#IndustrialLand").on('change', function () { addressSelection('IndustrialLand') });
131$("#Logistics").on('change', function () { addressSelection('Logistics') });
132function addressSelection(id) {
133    var itemId = $('#' + id).val();
134
135    jQuery.ajax({
136        method: "POST",
137        data: { itemId: itemId },
138        url: "/api/ports/GetContactAddress",
139        context: this,
140        success: function (addr) {
141            var summary = "";
142            var body = "";
143            if (addr.indexOf("Summary:") > -1) {
144                body = addr.slice(0, addr.indexOf("Summary:"));
145                summary = addr.slice(addr.indexOf("Summary:"));
146                summary = summary.replace('Summary:', '')
147            }
148            $('#' + id).closest('#drpdwnControl').find('#detailAddress').show();
149            $('#' + id).closest('#drpdwnControl').find('#detailAddress').html("");
150            $('#' + id).closest('#drpdwnControl').find('#detailAddress').append(body);
151
152
153            $('#' + id).closest('#drpdwnControl').find('#mainAddress').show();
154            $('#' + id).closest('#drpdwnControl').find('#mainAddress').html("");
155            $('#' + id).closest('#drpdwnControl').find('#mainAddress').append(summary);
156
157            /*$("#CustomerCareCenterArea").show();
158            $("#addressColl").html("");
159            $("#addressColl").append(addr);*/
160        }
161    });
162}
163// JS changes countactUs onClick function

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.