var noxc = ''; //alert(noxc); function pasaContacto() { if ($('#terminos').prop('checked')) { window.onload = obtener(); } else { showmodalTerminosContacto(); } } var showPlan = function (item1, item2, item3, item4, item5, item6, event) { $('#' + item1).hide(); $('#' + item2).show(); $('#' + item3).removeClass('activePlan'); $('#' + item4).addClass('activePlan'); $('#' + item5).hide(); $('#' + item6).show(); event.preventDefault(); }; mapa = { map: false, marker: false, initMap: function () { }, getCoords: function () { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(coordenada, error); } else { showmodalNoLocationBrowser(); } }, } function coordenada() { //$("#loading").show(); var geocoder = new google.maps.Geocoder(); address = document.getElementById('search').value; if (address != '') { geocoder.geocode({ 'address': address }, function (results, status) { var latitud = results[0].geometry.location.lat(); var longitud = results[0].geometry.location.lng(); var Address = latitud + "," + longitud; var NombreApi = "CoberturaAltan"; var url = "footers/ConsumoIndexCobertura.php"; var data = { 'NombreApi': NombreApi, 'Address': Address }; $.ajax({ url: url, data: data, method: 'post', success: function (data) { $("#loading").hide(); //console.log(data); var row = JSON.parse(data); //console.log(row); if (row.Description == "") { window.location ="https://www.internetnox.com.mx/coberturaTrue.php?result="+row.Result+"&address="+address+"&Lat="+latitud+"&Lon="+longitud; } else { window.location ="https://www.internetnox.com.mx/coberturaFalse.php?address="+address; } }, error: function (error) { console.log('Error en la operacion'); } }); }); } } function error(errorCode) { if (errorCode.code == 1) coordenada(); else if (errorCode.code == 2) showmodalUnavailablePosition(); else showmodalGenericError(); } function ValCobertura() { $("#loading").show(); var calle = document.getElementById('calle').value; var numero_exterior = document.getElementById('numero_exterior').value; var colonia = document.getElementById('colonia').value; var cp = document.getElementById('cp').value; var ciudad = document.getElementById('ciudades').value; var estado = document.getElementById('estados').value; var direccionC = calle + ' ' + numero_exterior + ', ' + colonia + ', ' + cp + ', ' + ciudad + ', ' + estado; document.getElementById('search').value = direccionC; window.onload = mapa.getCoords(); } //////////////////////////CONTACTO///////////////////////////////// function obtener() { var firstName = document.getElementById('nombre').value; var lastName = document.getElementById('apellido').value; var phoneMobile = document.getElementById('tel_casa').value; var emailAdd = document.getElementById('email').value; var descripcion = document.getElementById('mensajeContacto').value; if ((firstName=="")||(lastName=="")||(phoneMobile=="")||(emailAdd=="")){ swal("Por favor llene todos los campos","","warning"); }else{ var url = "footers/ConsumoIndexContacto.php"; var parametros = { "descripcion": descripcion, "nombre": firstName, "apellidos": lastName, "telMovil": phoneMobile, "correo": emailAdd, "TipoVenta": "1" }; console.log(parametros); $.ajax({ url: url, data: parametros, method: 'post', success: function (data) { console.log(data); showmodalDataSentSuccess(); document.getElementById('nombre').value = ""; document.getElementById('apellido').value = ""; document.getElementById('tel_casa').value = ""; document.getElementById('email').value = ""; document.getElementById('mensajeContacto').value = ""; }, error: function (error) { console.log(error); } }); } } $(function () { $.post('cfdi.php').done(function (respuesta) { $('#cfdiFisica').html(respuesta); }); $.post('cfdiMoral.php').done(function (respuesta) { $('#cfdiMoral').html(respuesta); }); $.post('estado.php').done(function (respuesta) { $('#estados').html(respuesta); }); $('#estados').change(function () { var el_estado = $(this).val(); $.post('ciudades.php', {estado: el_estado}).done(function (respuesta) { $('#ciudades').html(respuesta); }); }); $('#ciudades').change(function () { var la_ciudad = $(this).val(); $.post('cp.php', {ciudad: la_ciudad}).done(function (respuesta) { $('#cp').html(respuesta); }); }); $('#cp').change(function () { var el_cp = $(this).val(); $.post('colonias.php', {cp: el_cp}).done(function (respuesta) { $('#colonia').html(respuesta); }); }); $.post('estado.php').done(function (respuesta) { $('#estadosE').html(respuesta); }); $('#estadosE').change(function () { var el_estadoE = $(this).val(); $.post('ciudades.php', {estado: el_estadoE}).done(function (respuesta) { $('#ciudadesE').html(respuesta); }); }); $('#ciudadesE').change(function () { var la_ciudadE = $(this).val(); $.post('cp.php', {ciudad: la_ciudadE}).done(function (respuesta) { $('#cpE').html(respuesta); }); }); $('#cpE').change(function () { var el_cpE = $(this).val(); $.post('colonias.php', {cp: el_cpE}).done(function (respuesta) { $('#coloniaE').html(respuesta); }); }); $.post('estado.php').done(function (respuesta) { $('#estadosF').html(respuesta); }); $('#estadosF').change(function () { var el_estadoF = $(this).val(); $.post('ciudades.php', {estado: el_estadoF}).done(function (respuesta) { $('#ciudadesF').html(respuesta); }); }); $('#ciudadesF').change(function () { var la_ciudadF = $(this).val(); $.post('cp.php', {ciudad: la_ciudadF}).done(function (respuesta) { $('#cpF').html(respuesta); }); }); $('#cpF').change(function () { var el_cpF = $(this).val(); $.post('colonias.php', {cp: el_cpF}).done(function (respuesta) { $('#coloniaF').html(respuesta); }); }); });