如何在警报脚本中插入GEOIP标注?

I'm looking for a way to call out the user's city within the alert script, I have tried document.write but I'm no coder and spent several hours to no avail. I can use

<span id="city">{cityname}</span> 

on the page itself, but cannot get it to work in the alert script.

<head>
<script type="text/javascript" src="http://www.jsgeoip.com/geoip.js">   </script>
</head>
<body>
<script> 
$(document).ready(function() {
$('#city').html(geoip_city());
}); 
</script>
<script>alert('Welcome CITY HERE User');</script>
</body>

Just move the alert call to after you get the geoip. No use having that second script block, do it all in the one ready function:

$(document).ready(function() {
    var geoip = geoip_city();
    $('#city').html(geoip);
    alert('Welcome ' + geoip + ' User');
});