Witam,
Siedzę od kilku bitych godzin i nie mogę znaleźć błędu. Firebug też nie wywala błędów ?!
Oczywiście wcześniej wszelkie biblioteki są dołączone. Walidacja formularzy działa z tym ,że po wysłaniu zamiast treści jest pusta strona?!
<form name="contact" method="post" action=""> <label for="name" id="name_label"><b>Imię:
</b></label><label class="error" for="name" id="name_error">Wpisz swoje imię.
</label><br/> <input type="text" name="name" id="name" size="30" value="" class="text-input" /> <label for="email" id="email_label"><b>Adres E-mail:
</b></label><label class="error" for="email" id="email_error">Wpisz swój adres e-mail.
</label><br/> <input type="text" name="email" id="email" size="30" value="" class="text-input" /> <label for="phone" id="phone_label"><b>Zapytanie:
</b></label><label class="error" for="phone" id="phone_error">Wpisz treść zapytania.
</label><br/> <input type="submit" name="submit" class="button" id="submit_btn" value="Wyślij" />
$(function() {
$('.error').hide();
$(".button").click(function() {
// validate and process form
// first hide any error messages
$('.error').hide();
var name = $("input#name").val();
if (name == "") {
$("label#name_error").show();
$("input#name").focus();
return false;
}
var email = $("input#email").val();
if (email == "") {
$("label#email_error").show();
$("input#email").focus();
return false;
}
var phone = $("textarea#phone").val();
if (phone == "") {
$("label#phone_error").show();
$("textarea#phone").focus();
return false;
}
var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "process.php",
data: dataString,
success: function() {
$('#contact_form').html("<div id='message'></div>");
$('#message').html("<b>Wiadomość została wysłana.</b>")
.append("<p>dziękujemy.</p>")
.hide()
}
});
return false;
});
});
runOnLoad(function(){
$("input#name").select().focus();
});