How would you update a frontend form with AJAX

My solution ended up being:

<script>
var mb_user_location_current = ...
...
</script>

And then used those variables from the head to the function.

But then ventured down other paths for different solutions.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)