SHOW:
|
|
- or go back to the newest paste.
| 1 | <!DOCTYPE html> | |
| 2 | <html> | |
| 3 | <head> | |
| 4 | <title>prueba</title> | |
| 5 | <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
| 6 | <script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
| 7 | <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
| 8 | <link rel="stylesheet" href="/resources/demos/style.css" /> | |
| 9 | <script> | |
| 10 | $(function() {
| |
| 11 | ||
| 12 | $("#tags").autocomplete({
| |
| 13 | source : function( request , response ){
| |
| 14 | var url = "autocomplete.php"; | |
| 15 | $.post(url, { 'search' : request.term }, response, 'json');
| |
| 16 | }, | |
| 17 | select: function( event, ui ) {
| |
| 18 | $("#tags").val(ui.item.name);
| |
| 19 | //$('#hidden_tag').val(ui.item.name);
| |
| 20 | ||
| 21 | return false; | |
| 22 | } | |
| 23 | }).data("ui-widget")._renderItem = function(ul, item) {
| |
| 24 | return $("<li>").append( "<a>" + item.name + "</a>" ).appendTo( ul );
| |
| 25 | }; | |
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | }); | |
| 32 | </script> | |
| 33 | </head> | |
| 34 | <body> | |
| 35 | <div class="ui-widget"> | |
| 36 | <input type="hidden" id="hidden_tag" name="hiddentag" value=""> | |
| 37 | <label for="tags2">Tags: </label> | |
| 38 | <input id="tags" /> | |
| 39 | </div> | |
| 40 | ||
| 41 | </body> | |
| 42 | - | </html> |
| 42 | + | </html> |
| 43 | <? | |
| 44 | $data=array('name'=>'prueba');
| |
| 45 | echo json_encode($data); | |
| 46 | ?> |