...

View Full Version : How do I access the header using AJAX?



whatg
04-14-2011, 12:45 PM
Say for example I had had page with the url of:

foo.php?bar='blob'

Is it possible to get the value of blob?

For example:


xmlhttp.open("GET","new_film_pro.php?x="+blob,true);

Thanks,

Apologies for not being very technical.

devnull69
04-14-2011, 01:13 PM
You can access the URL of the current page and then use regular expressions to filter for the value of bar


var theMatch = location.href.match(/bar=(.*)&/);
var theValue = '';
if(theMatch) {
theValue = theMatch[1]; // bar=xxxx is one of several parameters
} else {
theMatch = location.href.match(/bar=(.*)$/);
if(theMatch) theValue = theMatch[1]; // bar=xxxx is the only parameter
}
...
xmlhttp.open("GET","new_film_pro.php?x="+theValue,true);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum