[TYPO3-english] TYPO3.settings.ajaxUrls in custom Backend
Jennifer Koenig
jenka13all at gmail.com
Tue Oct 7 14:19:04 CEST 2014
Context: AJAX in TYPO3 6.2.5 with custom backend (no Prototype, no ExtJs)
I'm currently trying to set up a form in the backend that needs to use AJAX. When the user clicks a button in the form, data from the form elements should get sent as parameters to an action method in a controller. As reference I've used the following:
http://docs.typo3.org/typo3cms/CoreApiReference/JavaScript/Ajax/Backend/Index.html
I keep getting the error "ReferenceError: TYPO3 is not defined." for the following lines of code:
$.ajax({
type: "GET",
url: TYPO3.settings.ajaxUrls['PackageBuilder::checkFlightAvailability'],
data: { packageData: params }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});
TYPO3.settings.ajaxUrls is supposed to be a global javascript variable. However, I am using a custom backend that does not include Prototype (which just kept messing up ALL of my scripts) or ExtJs. Is this setting defined in one of those libraries?
What do I need to include in my Javascript, or what JS files do I need to include in my backend layout, in order to have TYPO3.settings defined as a global JS variable, as it should be?
More information about the TYPO3-english
mailing list