I have this code and this function and I want the value obtained in the function to be able to send it to a label in my index file so the user can see it.
for example if my select option says Rob my label says robertos
$(function(){
// Lista de empresas
$.post( 'continentes.php' ).done( function(respuesta)
{
$( '#continentes' ).html( respuesta );
});
// lista de tiendas
$('#continentes').change(function()
{
var el_continente = $(this).val();
// Lista de tiendas
$.post( 'paises.php', { continente: el_continente} ).done( function( respuesta )
{
$( '#paises' ).html( respuesta );
});
});
// Lista de Ciudades
$( '#paises' ).change( function()
{
var pais = $(this).children('option:selected').html();
alert( 'Lista de Ciudades de ' + pais );
});
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Inicio De Inventario</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../css/css.css" rel="stylesheet" type="text/css" />
<script src="functions.js"></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="background:url(../../images/topbaner.gif) repeat-y #d2e0f2;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="56%"><img src="../../images/logo.gif" width="167" height="39" alt="Logo" /></td>
<td width="44%" align="right" valign="bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="60%" align="right"> </td>
<td width="40%" align="right"><span style="padding-right:5px;">
<strong>Fecha: <?php echo date('d-m-Y'); ?>
</strong></span></td>
</tr>
<tr>
<td align="right">
<strong>Usuario:
</strong> <em><?php echo $Session['FullName']; ?></em>
</td>
<td align="right"><strong><a href="../../logout.php">Terminar Sesión</a></strong></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<tr>
<td width="84%" valign="top" bgcolor="#FFFFFF" style="border:1px solid #98c0f4;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--td valign="bottom" bgcolor="#d2e0f2" style="background-image:url(tab-strip-bg.gif); background-repeat:repeat-x; height:26px;"><table width="100%" border="0" cellspacing="0" cellpadding="0"--><!--color de la tabla-->
<tr>
<td>
<tr>
<td width="81%">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><div class="tabmenu" onClick="document.location.href='../index.php';">Inicio</div></td>
</tr>
</table>
</td>
</tr>
</td>
</tr>
</tr>
</table>
</td>
</tr>
</td>
</tr>
<td>
<br><table width="98%" border="3" align="center" cellspacing="10">
<tr>
<td><h2><pre>Webinv Gestion De Inventarios</pre></h2></td>
</tr>
<tr>
<td align="left" border="1">Inicio De Inventario
<form action="" name="form1">
<br>
<table width="100%" border="0">
<tr>
<td width="10%" valign="bottom"> <label>Empresa:</label></td>
<td width="6%">
<select name="continentes" id="continentes" >
<option value="0">Seleccione</option>
</select></td>
<td>
<label name="empresa" id "empresa"></label>
</td>
<td width="11%"><label>Fecha</label></td>
<td width="40%"><?php echo date('d-m-Y'); ?></td>
</tr>
<tr>
<td><br> <label>Almacen:</label></td>
<td><br><select name="paises" id="paises">
<option value="0">Seleccione</option>
</select></td>
<td><?php echo $el_continente; ?></td>
<td>Folio De Inventario</td>
<td><?php echo $el_continente; ?></td>
</tr>
<tr>
<td><br> <label for="res">Responsable:</label></td>
<td><br><select>
<?php while ($row3=mysql_fetch_array($usur))
{?>
<option value="<?php echo $row3['usuario']?>"><?php echo $row3['usuario'];?></option>
<?php } ?>
</select></td>
<td><em><?php echo $empr5['elemento'] ?></em></td>
<td><label for="mot"> Motivo Del Inventario</label></td>
<td><select>
<?php while ($row4=mysql_fetch_array($moti))
{?>
<option value="<?php echo $row4['motivo']?>"><?php echo $row4['motivo'];?></option>
<?php } ?>
</select><label><em><?php echo $Session['FullName']; ?></em></label></td>
</tr>
<tr>
<td><br> <label for="res">Tipo De Usuario:</label></td>
<td> <br><em><?php echo $row3['tip_usuario']?></em></td>
<td> </td>
<td> </td>
<td></td>
</tr>
</table>
<br>
<br>
<br>
</form>
</td>
</tr>
<tr>
<td><form action="form.php" method="get" name="form2">
<table width="1063" border="0">
<tr>
<td width="151"><h1><pre>Inventario Anterior</pre></h1></td>
<td width="253"></td>
<td width="237"> </td>
<td width="78"> </td>
<td width="322"> </td>
</tr>
<tr>
<td><br>Motivo De Inventario:</td>
<td> </td>
<td> </td>
<td><br>Fecha:</td>
<td> </td>
</tr>
<tr>
<td><br>Responsable:</td>
<td></td>
<td></td>
<td><br>Ultimo Folio</td>
<td></td>
</tr>
</table>
</form></td>
</tr>
</table>
</table>
<tr><table width="98%" border="0" align="center">
<tr>
<td width="100%" align="right" border"0"><input name="Cancelar" type="reset" value="Restablecer" /><input name="Aceptar" type="submit" value="Enviar" /></td>
</tr>
</table>
<td style="background:url(../../images/light-hd.gif) repeat-x #d2e0f2; height:26px; border-top:1px solid #98c0f4; border-bottom:1px solid #98c0f4; padding-left:5px; padding-right:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" align="right" > <a href="mailto:[email protected]">Soporte</a></td>
</tr>
</td>
</tr>
</td>
</body>
</html>