Results 1 to 5 of 5
  1. #1
    rashriaz is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default How to redirect to thank you page

    I have a contact form which submits infomation to my email address but at the moment the form submits the information and says thank you on the same page. I need to to redirect to a thank you page.

    my code is
    Java Code:
     // Contact Form
    	$('.validate-form').submit(function(){
    		var form = $(this);
    		form.find('.required').parents('.row:eq(0)').removeClass('field-error');
    		
    		var field, v, id, msg, t, field_holder;
    		var alert_msg = $('.msg-alert');
    		var error = false;
    		form.find('.required').each(function(){
    			field = $(this);
    			field_holder = field.parents('.row:eq(0)');
    			v = $(this).val();
    			t = $(this).attr('title');
    			id = $(this).attr('id');
    			
    			if( $(this).hasClass('valid-email') ){
    				if( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(v) == false ) {
    					error = true;
    				}
    			}else {
    				if( v == '' || v == t ){
    					error = true;
    				}
    			}
    			
    			if( error ) {
    				field.addClass('field-error');
    				alert_msg.fadeIn();
    				//error_fields.push( field );
    			}
    		});
    		
    		if( !error ) {
    		
    			form.find('.required').removeClass('field-error');
    			var data = {}
    			
    			form.find('.text-field').each(function(){
    				data[ $(this).attr('name') ] = $(this).val();
    			});
    			
    			form.find('.text-field').each(function(){
    				$(this).val( $(this).attr('title') );
    			});
    			
    			$('#message-field').val( 'Sending...' );
    			
    			$.post('send.php', data, function(){
    				alert_msg.fadeOut();
    				form.find('.msg-thanks').fadeIn(function(){
    					
    					$('#message-field').val( $('#message-field').attr('title') );
    					
    					window.setTimeout(function(){
    						form.find('.msg-thanks').fadeOut();
    					}, 5000);
    					
    				});
    			});
    		}
    		
    		return false;
    	});
    any help with this would be great. thanks

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,516
    Blog Entries
    7
    Rep Power
    20

    Default Re: How to redirect to thank you page

    That definitely isn't Java and this is a Java forum so we can't help you.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    rashriaz is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Re: How to redirect to thank you page

    the file is a .js file, is that not a java file ?

    if not have you any idea what it is /

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to redirect to thank you page

    No.
    That's Javascript.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default Re: How to redirect to thank you page

    Off topic, closing.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. redirect to a servlet page
    By niteangell21 in forum New To Java
    Replies: 5
    Last Post: 11-15-2010, 02:53 PM
  2. Redirect To Same Page
    By systech44 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 12-08-2009, 11:27 AM
  3. redirect to html page
    By simo_mon in forum Java Servlet
    Replies: 3
    Last Post: 02-12-2009, 05:18 PM
  4. Redirect page in web service
    By bluesheeva in forum Advanced Java
    Replies: 3
    Last Post: 02-03-2009, 11:56 PM
  5. redirect page within a java applet
    By paul in forum Java Applets
    Replies: 1
    Last Post: 08-07-2007, 05:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •