i want to pass a javascript string to php ... WHICH is RIGHT after the code .. in the script.
PHP is executed server side while javascript is client side, so that means that the PHP is already executed when you're sending your javascript code.
You might want to look into AJAX instead.