-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparcelforce-quote.html
67 lines (52 loc) · 2.62 KB
/
parcelforce-quote.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel=stylesheet href=https://cdn.simplecss.org/simple.css>
<title>Postage Quote Calculator</title>
</head>
<body>
<h1>Postage Quote Calculator</h1>
<form id="quoteForm">
<label for="col">Collection Country Code (col):</label>
<input type="text" id="col" name="col" required><br><br>
<label for="dest">Destination Country Code (dest):</label>
<input type="text" id="dest" name="dest" required><br><br>
<label for="cp">Collection Postcode (cp):</label>
<input type="text" id="cp" name="cp" required><br><br>
<label for="dp">Destination Postcode (dp):</label>
<input type="text" id="dp" name="dp" required><br><br>
<h3>Parcel Details</h3>
<label for="weight">Weight (kg):</label>
<input type="number" id="weight" name="weight" step="0.01" required><br><br>
<label for="length">Length (cm):</label>
<input type="number" id="length" name="length" required><br><br>
<label for="width">Width (cm):</label>
<input type="number" id="width" name="width" required><br><br>
<label for="height">Height (cm):</label>
<input type="number" id="height" name="height" required><br><br>
<button type="submit">Get Quote</button>
</form>
<script>
document.getElementById('quoteForm').addEventListener('submit', function(e) {
e.preventDefault(); // Prevent the form from submitting
// Collect form data
const col = document.getElementById('col').value;
const dest = document.getElementById('dest').value;
const cp = document.getElementById('cp').value;
const dp = document.getElementById('dp').value;
const weight = document.getElementById('weight').value;
const length = document.getElementById('length').value;
const width = document.getElementById('width').value;
const height = document.getElementById('height').value;
// Join weight, length, width, and height in the required format
const parcelDetails = `1~${weight}|${length}|${width}|${height}`;
// Construct the URL
const url = `https://send.parcelforce.com/quotes?col=${col}&dest=${dest}&cp=${encodeURIComponent(cp)}&dp=${encodeURIComponent(dp)}&mdd=0&p=${encodeURIComponent(parcelDetails)}"etype=Default`;
// Redirect to the constructed URL
window.location.href = url;
});
</script>
</body>
</html>