git.schokokeks.org
Repositories
Help
Report an Issue
webinterface.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
98e28e5
Branches
Tags
master
ticket
webinterface.git
modules
contacts
edit.js
Prüfe Nummern via AJAX
Bernd Wurst
commited
98e28e5
at 2018-01-24 10:34:58
edit.js
Blame
History
Raw
function populate_number(result) { var field = result.field; if (result.valid == 1) { $("#"+field).val(result.number); $("#"+field+"_feedback").html('<img src="../../images/ok.png" style="height: 16px; width: 16px;" />'); } else { $("#"+field+"_feedback").html('<img src="../../images/error.png" style="height: 16px; width: 16px;" alt="Nummer scheint nicht gültig zu sein" title="Nummer scheint nicht gültig zu sein" />'); } } function check_number( field ) { return function () { if ($("#"+field).val().length > 0) { var number = $("#"+field).val(); var country = $("#land").val(); $("#"+field).prop("disabled", true); $.getJSON("numbercheck?number="+encodeURIComponent(number)+"&country="+encodeURIComponent(country)+"&field="+field, populate_number) .always( function() { $("#"+field).prop("disabled", false); }); } else { $("#"+field+"_feedback").html(''); } } } $(function() { $('#telefon').on("change paste", check_number("telefon") ); $('#mobile').on("change paste", check_number("mobile") ); $('#telefax').on("change paste", check_number("telefax") ); });