Im so noob at this, been working with PHP and Js for like 4 months, sorry if im making a noob question, also, im a spanish speaker, sorry for english grammar fails you are going to read =[
Basically, this is my problem: In this Php File i have some Vars and VarArrays, i need to send them to another one
//First PHP File - This one Search on DataBase, at the end, i have 5 vars, 2 of them are arrays
<?php
$var1 = '1';
$var2 = '2';
$var3 = '3';
$arr1 = array();
$arr2 = array();
//¿How to json_encode the 5 vars above?//
?>
In this one i need to catch the previus values
//Second PHP File
<?php
$newVar1 = $_POST['var1'];
$newVar2 = $_POST['var2'];
$newVar3 = $_POST['var3'];
$newArr1 = $_POST['arr1'];
$newArr2 = $_POST['arr2'];
?>
I think i have to do something like this, but how should i do it?:
$.ajax({
type: "POST",
url: "php/FIRSTFILE.php",
data: ????,
dataType: "json",
success:
function(respuesta)
{
$('#MainDiv').load('php/SECONDFILE.php', function(data) {
$(this).html(data);
});
$('#MainDivLabelVar1').val(respuesta.¿¿EncodeStuff??);
}
});
php/CATBuscar.phpsend back the data? Note you need to echo out a JSON item.curlor similar directly). I presume you are rendering one PHP page, and progressing to the other either by normal POST request or by AJAX? 2. Can we see the output ofphp/CATBuscar.phpwithidandCATparameters? You can get it from the Network panel of your browser's Developer Tools.