Ajax

Ajax is an acronym for Asynchronous JavaScript And XML is a web development technique for creating interactive web applications. For more information about this new and exciting technology see Wikipedia.

Here is my example, please enter two QTH locators:

submit

The result will be displayed here.


Behind the scenes of this example, i.e. on the server, is a PHP scrpit which handles the javascript response.

<?php
header ('Content-Type: text/plain');

require 'functions.php'; // Contains the QTH functions

$loc1 = strtoupper($_REQUEST['q1']);
$loc2 = strtoupper($_REQUEST['q2']);

loc2pos( $loc1, &$lat1, &$lng1 );
loc2pos( $loc2, &$lat2, &$lng2 );

if( checkloc( $loc1 ) && checkloc( $loc2 ) ) {
  distazim( $lat1, $lng1, $lat2, $lng2, &$dist, &$azim );
  printf( "Distance: %.0f km<br />Azimuth: %.0f&deg;\n", $dist, $azim );
} else {
  echo 'You have to enter <span style="color: #f00;">both '.
       "locators</span> correctly\n";
}
?>

Try calling the PHP script directly using various queries:

When you click on these links, the browser is displaying the server response which in the original example is replacing the text "The result will be displayed here."