lokesh341 commited on
Commit
ab7048f
·
verified ·
1 Parent(s): 9e11fb3

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +12 -4
templates/index.html CHANGED
@@ -252,6 +252,8 @@
252
  return;
253
  }
254
  console.log("Sending data:", { name, email, phone });
 
 
255
  fetch('/submit', {
256
  method: 'POST',
257
  headers: { 'Content-Type': 'application/json' },
@@ -261,22 +263,28 @@
261
  .then(data => {
262
  console.log("Response Data:", data);
263
  if (data.success) {
 
264
  speak(`Thank you for registering, ${name}!`, function () {
265
  speak(`Hi ${name}, Welcome to Biryani Hub. Speak out.`);
266
  });
 
 
267
  let statusText = document.getElementById('statusText');
268
  let statusMessage = document.getElementById('statusMessage');
269
 
270
  if (statusText && statusMessage) {
271
  statusText.textContent = `Thank you for registering, ${name}!`;
272
  statusMessage.style.display = 'block';
 
 
273
  setTimeout(() => {
274
  statusText.textContent = 'Submitted Successfully!';
 
 
275
  setTimeout(() => {
276
- // Refresh the page after 10 seconds
277
- window.location.reload();
278
- }, 10000); // Refreshes after 10 seconds
279
- }, 6000);
280
  }
281
  } else {
282
  speak("There was an error submitting your details. Please try again.");
 
252
  return;
253
  }
254
  console.log("Sending data:", { name, email, phone });
255
+
256
+ // Send the data to the backend (Salesforce)
257
  fetch('/submit', {
258
  method: 'POST',
259
  headers: { 'Content-Type': 'application/json' },
 
263
  .then(data => {
264
  console.log("Response Data:", data);
265
  if (data.success) {
266
+ // Speak the success message
267
  speak(`Thank you for registering, ${name}!`, function () {
268
  speak(`Hi ${name}, Welcome to Biryani Hub. Speak out.`);
269
  });
270
+
271
+ // Show the success message on screen
272
  let statusText = document.getElementById('statusText');
273
  let statusMessage = document.getElementById('statusMessage');
274
 
275
  if (statusText && statusMessage) {
276
  statusText.textContent = `Thank you for registering, ${name}!`;
277
  statusMessage.style.display = 'block';
278
+
279
+ // Wait for 6 seconds before changing the status text
280
  setTimeout(() => {
281
  statusText.textContent = 'Submitted Successfully!';
282
+
283
+ // Refresh the page after 10 seconds
284
  setTimeout(() => {
285
+ window.location.reload(); // This will refresh the page
286
+ }, 10000); // Refresh after 10 seconds
287
+ }, 6000); // Wait for 6 seconds before updating status message
 
288
  }
289
  } else {
290
  speak("There was an error submitting your details. Please try again.");