@gwarah e @LucaoA coloquei no código como vc´s sugeriram e não funcionou nem o alert no php ficou <input type="hidden" value="<?=$cidade;?>" id="idCidade"/>
e no clima.js ficou var idCidade = window.document.getElementById ('idCidade').value; // função do arquivo clima.js var result = getClima(idCidade); alert(result); $(document).ready(function() { $.simpleWeather({ location: 'result, BR', woeid: '', unit: 'C', success: function(weather) {
seria assim mesmo?