I have this code in JavaScript:
$.ajax({
type: "POST",
url: "funcoes/a-php/ler/ler_config.php",
data: 'data_id=fish/config/horse/config/car',
cache: false,
success: function(data_o){
alert(data_o);
}
});
and on the file 'ler_config.php' I have this codes:
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$data = $_POST['data_id'];
list($name, $value) = explode('=', $data, 2);
$result = explode('/config/', $value);
print_r($result);
}
So I'm having trouble with this line:
list($name, $value) = explode('=', $data, 2);
and php notice me this messanger:
Undefined offset 1
So how can I fix it?
$_POST['data_id'] = 'fish/config/horse/config/car';