Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <field
  2. name="studio_id"
  3. type="text"
  4. label="COM_JPANIMES_STUDIO_LABEL"
  5. description="COM_JPANIMES_STUDIO_DESC"
  6. size="100"
  7. class="span5"
  8. default=""
  9. />
  10.  
  11. $( "#jform_studio_id" ).autocomplete({
  12.  
  13. minLenght:0,
  14.  
  15. source: function( request, response ) {
  16. $.ajax({
  17. url : 'index.php?format=raw&option=com_mycomponent&task=testing',
  18. dataType: "raw",
  19. type: "POST",
  20. data: {search: request.term,},
  21.  
  22. success: function( data ) {
  23. response( $.map( data, function( item ) {
  24. return {
  25. label: item.studio_name,
  26. studio_id: item.studio_id
  27. }
  28. }));
  29. }
  30. });
  31. },
  32.  
  33. select: function( event, ui ) {
  34.  
  35. $("#jform_studio_id").val(ui.item.studio_id);
  36. },
  37.  
  38. messages: {
  39. noResults: '',
  40. results: function() {}
  41. },
  42.  
  43. open: function() {
  44. $("ul.ui-menu").width( $(this).innerWidth() );
  45. }
  46.  
  47. <?php
  48. defined('_JEXEC') or die('Restricted access');
  49.  
  50. class JpanimesController extends JControllerLegacy
  51. {
  52. protected $default_view = 'mycomponent';
  53.  
  54. public function testing() {
  55.  
  56. $studios[] = array('studio_id' => '1', 'studio_name' => 'studio');
  57.  
  58. echo json_encode($studios);
  59. }
  60. }
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement