corrade-http-templates – Blame information for rev 62

Subversion Repositories:
Rev:
Rev Author Line No. Line
62 office 1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery UI Autocomplete - Remote JSONP datasource</title>
7 <link rel="stylesheet" href="../../themes/base/all.css">
8 <link rel="stylesheet" href="../demos.css">
9 <style>
10 .ui-autocomplete-loading {
11 background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
12 }
13 </style>
14 <script src="../../external/requirejs/require.js"></script>
15 <script src="../bootstrap.js">
16 function log( message ) {
17 $( "<div>" ).text( message ).prependTo( "#log" );
18 $( "#log" ).scrollTop( 0 );
19 }
20  
21 $( "#birds" ).autocomplete({
22 source: function( request, response ) {
23 $.ajax( {
24 url: "search.php",
25 dataType: "jsonp",
26 data: {
27 term: request.term
28 },
29 success: function( data ) {
30 response( data );
31 }
32 } );
33 },
34 minLength: 2,
35 select: function( event, ui ) {
36 log( "Selected: " + ui.item.value + " aka " + ui.item.id );
37 }
38 } );
39 </script>
40 </head>
41 <body>
42  
43 <div class="ui-widget">
44 <label for="birds">Birds: </label>
45 <input id="birds">
46 </div>
47  
48 <div class="ui-widget" style="margin-top:2em; font-family:Arial">
49 Result:
50 <div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
51 </div>
52  
53 <div class="demo-description">
54 <p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.</p>
55 <p>The datasource is a server-side script which returns JSONP data, specified via a function which uses <code>jQuery.ajax()</code> for the <code>source</code> option.</p>
56 </div>
57 </body>
58 </html>