Loans - Loan - Loans - Mortgages - Loans

PDA

View Full Version : PHP And Javascript


glasglow
Jun 19th 2007, 8:54 am
I have a .js file calling a page title (document.title) and would like to use that title as a variable like:

$star = the.js;

What I am trying to do is bring the output from the .js file into the php file as the data for the variable. Is it possible?

Mike H.
Jun 19th 2007, 9:39 am
Use AJAX to do that. process.php, is a separate document, it cannot be the same as the document.title one.

function processTitle(){

var AdminRequest = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
var nTitle = "?title=" + document.title;
AdminRequest.open("GET", "process.php"+nTitle, true);
AdminRequest.send(null);
}


$star = $_GET['title'];

glasglow
Jun 19th 2007, 10:06 am
Thanks I'll try it out.