How to combine PHP and Javascript together?
<p>I have a function in my Javascript script that needs to talk with the PHP to get the data in my database. But I'm having a small problem because I start the PHP in the for loop in Javascript, and then inside that for loop I get the data in my database. But the pointer in the for loop inside the PHP code is not working.. I guess the problem is in escaping? Or maybe it's not possible at all.</p>

<p>Here's my code:</p>

<pre><code>(function() {
  var data = [];
  for(var i = 0; i &lt; 25; i++) {
    data[i] = {
       data1: "&lt;a href='&lt;?= $latest[?&gt;i&lt;?=]-&gt;file; ?&gt;'&gt;&lt;?= $latest[?&gt;i&lt;?=]-&gt;title; ?&gt;&lt;/a&gt;", // The problems
       data2: ....
    };
  };
});
</code></pre>
