Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Need a little help with a jquery form success function.

    Hi there!

    I have an issue with the form I incorporated into my website. It sends the email to me in the end with the right information but there seems to be an issue when it's finished sending. It is supposed to close and submit a message saying Thank you but instead it drags down or just closes without saying anything. To clarify, the box animates and closes upwards without reloading the page and displays a Thank you, We will contact you soon ! in the grey bar that remains.


    Here's the code in the html:
    Code:
    		<script>
    		$(document).ready(function() {
    			
    			
    			
    			// SUCCESS AJAX CALL, replace "success: false," by:     success : function() { callSuccessFunction() }, 
    			$("#form1").validationEngine({
    				ajaxSubmit: true,
    					ajaxSubmitFile: "ajaxSubmit.php",
    					ajaxSubmitMessage: "Thank you, We will contact you soon !",
    				success : function() { callSuccessFunction() },
    				failure : function() {}
    			})
    			
    
    		
    		});
    		</script>
    I tried to do this, as per Old_Pedant's suggestion:
    Code:
         success : function() { alert("email sent successfully"; },
         failure : function() { alert("unable to send email"; }
    But it didn't work.

    Please if someone could help me button this up, it would be fantastic and I'll be able to finish this little project of mine. Greatly appreciate it! If any more details are needed please let me know.
    Last edited by Cyrusis; 12-19-2012 at 11:37 PM.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    should be

    Code:
        success : function() { alert("email sent successfully"); },
         failure : function() { alert("unable to send email"); }

  • Users who have thanked DanInMa for this post:

    Cyrusis (12-19-2012)

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Excellent that seemed to work. I updated the site for you to see. It works but I don't really like old school prompt box that pops up? It seems to have worked nicely on the page once submitting.

    Any suggestions to keeping it working and removing the box prompt? Thank you!

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    you could make your own modal, use jquery ui's dialog/modal (http://jqueryui.com/dialog/#modal-message), you are only limited by your imagination.

    you can also add a hidden div and use .show and .hide to show and hide it and .html() to change the contents of the div so you can use the same div for any of your form feedback

  • Users who have thanked DanInMa for this post:

    Cyrusis (12-19-2012)

  • #5
    New Coder
    Join Date
    Dec 2012
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hey Dan, is there any way you can show me an example of this? I'm not very familiar with much outside of HTML and CSS.

    I should probably take the time to learn but I honestly don't have the time.

    Thank you so much.

  • #6
    New Coder
    Join Date
    Dec 2012
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Can someone please elaborate on this?

    I don't know how to incorporate the hidden Div to the above modified code and the jquery link shows how to adjust the style of the box that prompts but not remove it?


    Thank you!


  •  

    Posting Permissions

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