It seem you don't understand how PHP and JS works together.
Php generate HTML (maybe JS and CSS too). Then when this html is loaded by a client, JS is executed.
To get it in PHP or JS, you can use regex or modify the url from ?BLABLABLA
to ?key=BLABLABLA
. In PHP, "BLABLABLA" will be stored in $_GET['key']
EDIT :
well I misunderstood your question.
From "How to retrieve GET parameters from javascript?" :
-------------------------
With the window.location
object. This code gives you GET without the question mark.
window.location.search.replace( "?", "" );
-------------------------
From your example it will return BLABLABLA
window.location DOC
EDIT2 :
When you generate your Javascript in teste.php, you should do this :
$str = "";
foreach ($_GET as $key => $value) {
$str = $key;
}
echo "var getParam = ".$str.";";
I don't see how to avoid foreach if you don't know what is given. You may have to rebuilt the parameters string ("?xxx=sss&ddd=zz...")
Now you JS variable getParam should contains BLABLABLA
Apolo