-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
97 lines (81 loc) · 3.29 KB
/
index.php
File metadata and controls
97 lines (81 loc) · 3.29 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
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
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css">
<style>
/* form {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);} */
/* body {background-color: black;} */
</style>
</head>
<body>
<div class="container w-50 mt-5 p-5 bordered shadow">
<h2>SMS app</h2>
<form action="sms.php" method="post" id="my_form" class="my-3">
<!-- Mobile Number input -->
<div class="mb-4">
<label class="form-label" >Mobile Number</label>
<input type="text" id="number" class="form-control" />
</div>
<!-- Message input -->
<div class="mb-4">
<label class="form-label">Message</label>
<textarea class="form-control" id="text" rows="4"></textarea>
</div>
<!-- Submit button -->
<input class="btn btn-primary btn-block" type="submit" id="submit" value="SEND" />
</form>
</div>
<script>
$(document).ready(function() {
$('#submit').click(function(event) {
// prevent the default form submission
event.preventDefault();
// get the form data
var form = $("#my_form");
var url = form.attr('action');
// send the form data to the server using AJAX
$.ajax({
url: 'sms.php', // use the form's action attribute as the URL
type: 'POST', // use the form's method attribute as the HTTP method
data: formData,
success: function(response) {
// code to execute if the form submission is successful
alert('Message sent successfully!');
},
error: function(xhr, status, error) {
// code to execute if the form submission fails
alert('Message could not be sent. Please try again later.');
}
});
});
});
</script>
<!-- <script>
$(document).ready(function() {
$('#submit').on(click,function(event) {
// event.preventDefault(); // prevent the form from submitting normally
// var formData = $(this).serialize(); // serialize the form data
$.ajax({
url: 'sms.php', // the URL where the form data will be submitted
type: 'POST',
data: $("#my_form").serialize(), // the serialized form data
success: function(response) {
// code to execute if the form submission is successful
alert('Message sent successfully!');
},
error: function(xhr, status, error) {
// code to execute if the form submission fails
alert('Message could not be sent. Please try again later.');
}
});
});
});
</script> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</body>
</html>