Skip to content

Instantly share code, notes, and snippets.

@Konafets
Created September 15, 2014 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Konafets/40e4f6a85fdef67d600e to your computer and use it in GitHub Desktop.
Save Konafets/40e4f6a85fdef67d600e to your computer and use it in GitHub Desktop.
Company AutoSuggest
define('TYPO3/CMS/StagedealCompany/AutoSuggest', ['jquery-ui', 'jquery-ui'], function ($) {
jQuery(document).ready(function(){
var test = ['ACME, Flensburg', 'Arroba IT, Flensburg'];
// var ajaxURL = '<f:uri.action action="ajaxCompanySearch" controller="Company" pageType="1410614542" arguments="{term: term}" />';
var ajaxURL = 'index.php?type=1410614542&tx_stagedealcompany_mycompany[controller]=Company&tx_stagedealcompany_mycompany[action]=ajaxCompanySearch';
})
}
);
/**
* @return array
*/
public function ajaxCompanySearchAction() {
$arguments = $this->request->getArguments();
$term = $_GET['term'];
$companies = array('ACME, New York', 'Arroba IT, Flensburg', 'City on a Hill, Harrislee');
return json_encode($companies);
}
...
<input type="text" name="q" id="jquery" autocomplete="off" />
...
<script>require(['TYPO3/CMS/StagedealCompany/AutoSuggest']);</script>
["ACME, Los Angeles","Arroba IT, Flensburg","City on a Hill, Harrislee"]
@etobi
Copy link

etobi commented Sep 15, 2014

define('TYPO3/CMS/StagedealCompany/AutoSuggest', ['jquery-ui', 'jquery-ui'],
müsste heißen
define('TYPO3/CMS/StagedealCompany/AutoSuggest', ['jquery', 'jquery-ui'], function ($) {

und innerhalbt der {} solltest du dann $ statt jQuery benutzen.

@etobi
Copy link

etobi commented Sep 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment