Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <field
- name="studio_id"
- type="text"
- label="COM_JPANIMES_STUDIO_LABEL"
- description="COM_JPANIMES_STUDIO_DESC"
- size="100"
- class="span5"
- default=""
- />
- $( "#jform_studio_id" ).autocomplete({
- minLenght:0,
- source: function( request, response ) {
- $.ajax({
- url : 'index.php?format=raw&option=com_mycomponent&task=testing',
- dataType: "raw",
- type: "POST",
- data: {search: request.term,},
- success: function( data ) {
- response( $.map( data, function( item ) {
- return {
- label: item.studio_name,
- studio_id: item.studio_id
- }
- }));
- }
- });
- },
- select: function( event, ui ) {
- $("#jform_studio_id").val(ui.item.studio_id);
- },
- messages: {
- noResults: '',
- results: function() {}
- },
- open: function() {
- $("ul.ui-menu").width( $(this).innerWidth() );
- }
- <?php
- defined('_JEXEC') or die('Restricted access');
- class JpanimesController extends JControllerLegacy
- {
- protected $default_view = 'mycomponent';
- public function testing() {
- $studios[] = array('studio_id' => '1', 'studio_name' => 'studio');
- echo json_encode($studios);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement