Hi, I'm not very good at javascript, ajax, jquery and json I'm still learning and remembering that I already researched a lot, but could not do what I want. It is the following my project is in MVC with friendly url. On the page has a text box that validates the zip and displays the values of the freight I did with PHP, but I had to put two radio options to choose the type of freight, I wanted the moment I clicked on the type of freight for example "pac" or "sedex" it would refresh the page and send that value to a PHP variable.
here is the file load.js.
$(document).ready(function() {
$('#botao').click(function(){
$('#aguarde, #blanket').css('display','block');
});
$("input:radio").click(function() {
var cor = $(this).val();
var correio = cor;
$.post("lojavirtualpoo/carrinho<-não estou sabendo colocar isso aqui",
{
correio: correio
},function(){
console.log(correio);
});
});
});
This page is located in localhost / lojavirtualpoo / app / views / cart / Index.php, inside the Index.php page has these code to receive the value but does not receive localhost / lojavirtualpoo / app / views / cart / Index.php
$tipo_correio = $_POST["correio"];
var_dump($tipo_correio);
html code on the same page
<td>
<span class="tt1">Opção</span>
<?php if ($cep_destino != "") { ?>
<span class="tt2"><input type="radio" name="correio" value="pac"> 1</span>
<span class="tt2"><input type="radio" name="correio" value="sedex"> 2</span>
<?php } else { ?>
<span class="tt2">Nenhum resultado</span>
<?php } ?>
</td>