I need to assign a JS variable to a PHP variable. Even though I can do it in a simple program, I can’t make it work in a slightly imbricated one.

In this program, I am in a JS loop, where I call a « google map API ». In this loop, for each flag displayed on the map I will attach a marker. The contents of the marker is coming from a PHP function (meteorlogical information). Cannot do otherwise beacause I am using « file_get_contents » and it is very difficult to do that in JS (HttpRequest for example won’t work for this specific URL).

The contents returned by the PHP function is therefore indexed to the JS loop index. Since these are parallel, I also used a "$i=0;" then "$i++;" but this will execute only once. I get "$i=1", but then it stays at this value. So I get the same marker on every flag !!

Basically I need « $i=j » or « $i++ » to work. As I said, the following simple code works fine :

Var j=’Hello’;
<? $i='<script>document.write(j);</script>';
Echo $i ?> will produce ‘Hello’.

Thanks and happy holidays.