-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
56 lines (46 loc) · 1.65 KB
/
script.js
File metadata and controls
56 lines (46 loc) · 1.65 KB
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
// script.js
function changeImage(imagePath) {
document.getElementById('projectImage').src = imagePath;
}
$(document).ready(function() {
// To Handle form submission
$('#contactForm').on('submit', function(event) {
event.preventDefault(); // Prevent default form submission
// Gathering form data
var formData = $(this).serialize();
// Getting the form action URL
var formAction = $(this).attr('action');
// Sending the form data using an AJAX request
$.ajax({
type: 'POST',
url: formAction,
data: formData,
success: function(response) {
// To handle successful form submission
alert('Form submitted successfully!');
// To cllose the modal
$('#contactModal').modal('hide');
// Reset the form
$('#contactForm')[0].reset();
},
error: function(error) {
// Handle errors
alert('There was an error submitting the form. Please try again.');
}
});
});
// Showing the modal on button click
$('.contactUsBtn').on('click', function() {
$('#contactModal').modal('show');
});
$('#contactModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget);
var recipient = button.data('whatever');
var modal = $(this);
modal.find('.modal-title').text('Talk to us');
});
// Initializing the carousel
$('#whatWeDoCarousel').carousel({
interval: 3000 // Slide interval in milliseconds
});
});