How about, I'm trying to send an index.php variable to a modal without reloading the page at all, since some forms are previously filled in, then I can not just send by get and reload the page (which would be very easy)
var fech = $('#input').val();
I send index.php to a modal that is included in index.php , this modal I have it in a different modal.php file included in the same index.php as mentioned above
include("modal.php");
and probe with ajax, jquery etc but I just can not get the value (this scritp is inside index.php)
<script>
$("#btnsend").click(function(){
var fech = $('#input').val();
$.ajax({
method: "POST",
url: "modal.php",
data: { dato: fech }
})
.done(function(msg) {
alert( "Data Saved: " + fech);
});
});
</script>
This was my last test, the value is printed on the alert with success but it is not seen in the modal.
already in modal.php that's how I get this variable in a normal way but it is not displayed.
echo $vr2=$_POST["dato"];