61 lines
2.0 KiB
JavaScript
61 lines
2.0 KiB
JavaScript
$(document).ready(function() {
|
|
$('#menu a').click(function(){
|
|
$('#menu a').removeClass('aktmenulink');
|
|
$('#menu div').removeClass('aktmenuitem');
|
|
$(this).addClass('aktmenulink');
|
|
$(this).parent().addClass('aktmenuitem');
|
|
page = $(this).attr('page');
|
|
$('#content').load('http://www.fewo-rhein-zwbg.de/index.php?page='+page,function(){
|
|
if(page === 'anreise'){
|
|
drawmap();}
|
|
if(page === 'wohnung'){
|
|
console.log('Fullscreen mode!');}
|
|
if(page === 'anfrage'){
|
|
register_anfrage();}
|
|
});
|
|
});
|
|
});
|
|
|
|
function register_anfrage(){
|
|
$('#input_send').click(function(){
|
|
name = $('#input_name').val();
|
|
telefon = $('#input_telefon').val();
|
|
handy = $('#input_handy').val();
|
|
email = $('#input_email').val();
|
|
anfrage = $('#input_anfrage').val();
|
|
if(!name || !telefon || !IsEmail(email) || !anfrage ){
|
|
$('#message_success').hide();
|
|
$('#message_fail').show();
|
|
} else {
|
|
$.ajax({
|
|
url: 'http://www.fewo-rhein-zwbg.de/api.php?call=anfrage',
|
|
type: 'GET',
|
|
data: { name : name,
|
|
telefon : telefon,
|
|
email : email,
|
|
anfrage : anfrage,
|
|
handy : handy},
|
|
success: function (data) {
|
|
if(!data || !data['status']){
|
|
$('#message_success').hide();
|
|
$('#message_fail').show();
|
|
return;}
|
|
$('#message_success').show();
|
|
$('#message_fail').hide();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$('#input_clear').click(function(){
|
|
$('#input_name').val('');
|
|
$('#input_telefon').val('');
|
|
$('#input_handy').val('');
|
|
$('#input_email').val('');
|
|
$('#input_anfrage').val('');
|
|
});
|
|
}
|
|
|
|
function IsEmail(email) {
|
|
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
|
return regex.test(email);
|
|
} |