Pagamento com Pague seguro
Ola pessoal estou com dificuldades preciso fazer que o Valor do resultado obtido em uma pesquisa entre como valor no pague seguro
veja o codigo abaixo
Ja revirei o Google e não achei muita coisa simplificada
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calcular distancia entre cidades (mapas e rotas)</title>
<script src="http://code.jquery.com/jquery-1.8.1.js" type="text/javascript"></script>
</head>
<body>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function CalculaDistancia() {
$('#litResultado').html('Aguarde...');
//Instanciar o DistanceMatrixService
var service = new google.maps.DistanceMatrixService();
//executar o DistanceMatrixService
service.getDistanceMatrix(
{
//Origem
origins: [$("#txtOrigem").val()],
//Destino
destinations: [$("#txtDestino").val()],
//Modo (DRIVING | WALKING | BICYCLING)
travelMode: google.maps.TravelMode.DRIVING,
//Sistema de medida (METRIC | IMPERIAL)
unitSystem: google.maps.UnitSystem.METRIC
//Vai chamar o callback
}, callback);
}
//Tratar o retorno do DistanceMatrixService
function callback(response, status) {
//Verificar o Status
if (status != google.maps.DistanceMatrixStatus.OK)
//Se o status não for "OK"
$('#litResultado').html(status);
else {
//Se o status for OK
//Endereço de origem = response.originAddresses
//Endereço de destino = response.destinationAddresses
//Distância = response.rows[0].elements[0].distance.text
//Duração = response.rows[0].elements[0].duration.text
$('#litResultado').html("<strong>Origem</strong>: " + response.originAddresses +
"<br /><strong>Destino:</strong> " + response.destinationAddresses +
"<br /><strong>Distância</strong>: " + response.rows[0].elements[0].distance.text +
" <br /><strong>Duração</strong>: " + response.rows[0].elements[0].duration.text +
" <br /><strong>Preço</strong>: R$ " + (parseFloat(response.rows[0].elements[0].distance.text.substring(0, response.rows[0].elements[0].distance.text.length - 3).split(",").join(".")) * 1.5 + 30.00).toFixed(2).toString().split(".").join(",")
);
//Atualizar o mapa
$("#map").attr("src", "https://maps.google.com/maps?saddr=" + response.originAddresses + "&daddr=" + response.destinationAddresses + "&output=embed");
}
}
</script>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<label for="txtOrigem"><strong>Endereço de origem</strong></label>
<input type="text" id="txtOrigem" class="field" style="width: 400px" />
</td>
</tr>
<tr>
<td>
<label for="txtDestino"><strong>Endereço de destino</strong></label>
<input type="text" style="width: 400px" class="field" id="txtDestino" />
</td>
</tr>
<tr>
<td>
<p>
<input type="button" value="Calcular distância" onclick="CalculaDistancia()" class="btnNew" />
</p>
<table width="200" border="0">
<tr>
<th scope="col"><form target="pagseguro" method="post" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml">
<input type="hidden" name="email_cobranca" value="suporte@lojamodelo.com.br">
<input type="hidden" name="tipo" value="CP">
<input type="hidden" name="moeda" value="BRL">
<input type="hidden" name="item_id_1" value="12345">
<input type="hidden" name="item_descr_1" value="Moto frete">
<input type="hidden" name="item_quant_1" value="1">
// AQUI VAI O VALOR DADO NA PESQUISA
<input type="hidden" name="item_valor_1" value=" Preço">
<input type="image" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/pagamentos/99x61-pagar-assina.gif" name="submit" alt="Pague com PagSeguro - é rápido, grátis e seguro!">
</form>></th>
</tr>
</table>
<p> </p>
</td>
</tr>
</tbody>
</table>
<div><span id="litResultado"> </span></div>
<div style="padding: 10px 0 0; clear: both"></div>
</body>
</html>Discussão (0)
Carregando comentários...