Build API prefix using site_index

We need to account for whether the ExpressionEngine install has stripped the
index.php from the URL or not. `site_index` can tell us this. So, use
`site_index` to build an API prefix and pass that to the page so that the
JavaScript can use it.