Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AJAX Form

Featured Replies

Hi guys, I'm working on an AJAX/jQuery form at the moment. The form functions perfectly at the moment, the only thing I would like to do is when the form is valid and eventually been sent to the email, the div which holds the form is hidden to prevent the user constantly hitting submit.

 

The code for the form at the moment is as follows:

 

//engage on the page load
$(function() {
 //trigger ajax on submit
 $('#enquiry').submit( function(){

   //hide the form
   //$('#enquiryContainer').hide();

   //show the loading bar
   $('#loader').append($('.bar'));
   $('#bar').css({display:'block'});

   //send the ajax request
   $.get('sendEnquiry.php',{name:$('#name').val(),
				  telephone:$('#telephone').val(),
				  type:$('#type').val(),
                     email:$('#email').val(),
                     message:$('#message').val() },

   //return the data
   function(data){
     //hide the graphic
     $('#bar').css({display:'none'});
  $('#errors').text('');
  $('#errors').fadeIn(3000);
     $('#errors').append(data);
   });

 //stay on the page

 return false;

 });
});

 

I need something to say, if the response of the Ajax request is "Thankyou for submitting your enquiry..." then hide the form.

 

Anyone have any ideas?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.