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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2010
    Posts
    460
    Thanks
    214
    Thanked 1 Time in 1 Post

    JQuery I must have a small mistake as works elsewhere

    Hi,

    I know this works in principle as I have used it successfully on other pages I am using so I must have a typo or some other small mistake, I have gone over and over it, taken things out, put them back in and I can't for the life of me work out where my mistake is. Another pair of eyes would certainly be appreciated.

    My code is:
    Code:
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function (){
    $('#submitnewfestival').click(function(){
    	var data = $('#publicnewevent').serialize();
    	$.post ('insertPublicEvent.php',data, function(){
    				alert("Thank you for adding an event to our calendar.");
    			$('#publicnewevent').each (function(){
    				this.reset();
    				});
    			});	
    				return false;
    	});
    });
    </script>
    
    				<form action="" name="publicnewevent" id="publicnewevent" method="post" autocomplete="off" >
    
    
    <label class="two">Dress Code:</label>
    <input type="text" class="input" name="dresscode" id="dresscode" value="Enter Dress Code" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'Enter Dress Code':this.value;" size="100" />
    	
    	<br />
    	<br />
    <input type="button" name="submitnewfestival" id="submitnewfestival" value="Submit" /> &nbsp;
    </form>
    The insertPublicEventForm.php works as I have tested it without JQuery as a direct post. This is a heavily reduced version of the form, but even like this I can not get it to work.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,080
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by Jenny Dithe View Post
    Hi,

    I know this works in principle as I have used it successfully on other pages I am using so I must have a typo or some other small mistake, I have gone over and over it, taken things out, put them back in and I can't for the life of me work out where my mistake is.
    Jenny - Get yourself one of the many free File Compare utilities. This will expose any differences from one to another.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #3
    Regular Coder
    Join Date
    Sep 2010
    Posts
    460
    Thanks
    214
    Thanked 1 Time in 1 Post
    Thank you. I didn't know they existed, very helpful.


  •  

    Posting Permissions

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