I have a URL which is passed as a function parameter like:
requestCrossDomain('https://eosweb.larc.nasa.gov/cgi-bin/sse/grid.cgi?&num=197110&lat=23&submit=Submit&hgt=100&veg=17&sitelev=&[email protected]&p=grid_id&p=T10M&p=DLYRANGE&step=2&lon=16', function(results){
$('#loadedContent').css("display","").html(results);});
function requestCrossDomain( site, callback ) {
if ( !site ) {
alert('No site was passed.');
return false;
}
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
$.getJSON( yql, cbFunc );
function cbFunc(data) {
if ( data.results[0] ) {
data = data.results[0].replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
if ( typeof callback === 'function') {
callback(data);
}
}
else throw new Error('Nothing returned from getJSON.');
}
}
I am in need of changing the parameters in the URL corresponding to lat=23 and lon=16 to a user input.
I have tried doing it with string.replace but I am new to JavaScript. I cant get it working, how do I do this?