It is amazing how compact and simple it is.
import js.Dom;
import haxe.Http;
class Main
{
public static function main()
{
var cnx = new Http(???/quotation.n???);
cnx.onData = function(data)
{
var div = js.Lib.document.getElementById(???quotation???);
div.innerHTML = data;
}
cnx.onError = function(msg) { js.Lib.alert(???Error: ??? + msg); };
cnx.request(false);
}
}
Building an Auto - Complete Control
The previous example was quite basic. Of course there are more advanced uses for the AJAX technique
and one that is usually requested because it is really useful in the implementation of an auto - complete
control. An auto - complete control is a text input control that eases the data input suggesting valid
values. The suggestion uses the first characters input to filter a set of possible values. The more
characters are typed by the user, the narrower the filter result will be. While the list of possible values
can be very long, it is not a good idea to send it with the requesting page; instead an AJAX request is
performed every time a certain number of characters has been typed, thus reducing the communication
to only a subset of all the available possibilities.
Pages:
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788