...

View Full Version : JQuery I must have a small mistake as works elsewhere



Jenny Dithe
11-15-2010, 06:42 AM
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:


<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.

Philip M
11-15-2010, 08:09 AM
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.

Jenny Dithe
11-15-2010, 02:52 PM
Thank you. I didn't know they existed, very helpful.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum