At the beginning of the file I have the following code:
$.get(
"/users/getInfo",
"json"
).done(function(data){
window.User = data
})
import './components/map'
import './components/search'
import './components/jobs'
import './components/pagination'
import './components/pages'
import './components/users'
I will need window.User data in the code later on. Is it possible to force everything else to wait for the get request to be done?
I am trying this approach because I don't wanna expose user data directly with a code similar to this one:
<script>var User = <?php echo $user; ?>;</script>
The code from above will be minified so the user data will be a bit harder to find if anyone tries to find it.
async: false
?