"return false;" needs to be the _last_ thing it does, so move it to
the end of the function.. otherwise it hits return and quits the
function without doing anythig else.
eg:
$("#addShiftForm").submit(function() {
// do some stuff
return false;
});
On Dec 19, 7:54 am, pedalpete <[EMAIL PROTECTED]> wrote:
> Thanks Hamis,
>
> I think I'm getting closer, but maybe I'm not putting return false in
> the right location.
> I have been able to either stop the redirect, but the form does not
> get submitted by .ajax.
>
> now my jquery code looks like this, but nothing gets submitted.
>
> [ code]
> $("#addShiftForm").submit(function() {
> return false
> var startHrSelected = $("select[name='startHour']
> [EMAIL PROTECTED]")
> var startMinSelected = $("select[name='startMin']
> [EMAIL PROTECTED]")
> var endHrSelected = $("select[name='endHour'] [EMAIL
> PROTECTED]")
> var endMinSelected = $("select[name='endMin'] [EMAIL
> PROTECTED]")
> var startDateForm = $("input[name='date']")
> var uidForm = $("input[name='uid']")
> var sidForm = $("input[name='sid']")
>
> (this).ajax({
> type: "GET",
> url: "addShift.php",
> data: "startHour="+startHrSelected.val(),
> data: "startMin="+startMinSelected.val(),
> data: "endHour="+endHrSelected.val(),
> data: "endMin="+endMinSelected.val(),
> data: "startDate="+startDateForm.val(),
> data: "uid="+uidForm.val(),
> data: "sid="+sidForm.val(),
> success: function(){
>
> alert(startHrSelected);
> }
> });
>
> });
> [/code]
>
> thanks for your help.
> Pete