While looking at tons of examples of how to get a PHP variable sent to a JavaScript file, I still haven't had success getting it.
My PHP file is:
$title = $json["title"];
echo json_encode($title);
And my JavaScript file app.js is:
$.ajax({
url : 'index.php',
type : 'GET',
data : film,
dataType : 'json',
success : function (data) {
alert(data.title);
console.log(data.title);
},
})
I would like to know the right code to get the PHP $title variable to the ajax call in app.js.
Thanks