Here I would like to append the variable arr_icao and dep_icao to the url
var arr_icao = document.getElementById("arr_icao").value;
var dep_icao = document.getElementById("dep_icao").value;
$.ajax({
type: 'POST',
url: "http://localhost/position/route_finder/" + arr_icao + dep_icao,
success: function (data) {
$(".route-results").html(data);
}
});
You can use it like
var newUrl = "http://localhost/position/route_finder/" + arr_icao +"" + dep_icao;
$.ajax({
type: 'POST',
url: newUrl,
success: function(data) {
$(".route-results").html(data);
}
});
change from
url: "http://localhost/position/route_finder/" + arr_icao + dep_icao,
to
url: "http://localhost/position/route_finder/" + arr_icao + "/" + dep_icao,
You can keep adding parameters to the end of your URLS using ?
if its a GET request
"http://localhost/position/route_finder/?arr_ica="+arr_icao+"&dep_icao="+dep_icao
,
or if its a POST request
"http://localhost/position/route_finder/"+arr_icao+"/"+dep_icao
If route_finder
is a function with the 2 arguments then u should use
"http://localhost/position/route_finder/" + arr_icao + "/" + dep_icao,
if You are going to get the data using GET
method then use
"http://localhost/position/route_finder?arr_icao="+arr_icao+"&dep_icao="+dep_icao,
And as you have defined the method post you should go for
"http://localhost/position/route_finder/" + arr_icao + "/" + dep_icao,