Hallo zusammen,
ich hab grade ein Brett vorm Kopf.
Will mit Simple Ajax Daten aktualisieren. Folgenden Code habe ich.
config.php
PHP-Code:
$GLOBALS['TL_HOOKS']['simpleAjaxFronted'][] = array('Spelling', 'testAlex');
Spelling.php
PHP-Code:
class Spelling
{
public function testAlex()
{
if ('myrequest' === Input::get('acid')) {
$return = ['foo', 'bar', 'foobar'];
header('Content-Type: application/json');
echo json_encode($return);
exit;
}
}
}
JavaScript Code
HTML-Code:
(function ($) {
$(document).ready(function () {
$('#spellit').click(function () {
$.ajax({
type: "GET",
url: "SimpleAjaxFrontend.php",
data: {
acid: "myrequest"
},
success: function (result) {
alert('test');
}
});
});
});
})(jQuery);
Wenn der Prozess fertig ist, sollte die Meldung "test" kommen. Leider erhalte ich diese Meldung nicht.
Hab auch schon mit POST und GET versucht.
Was stimmt bei meinem Code nicht?
Lesezeichen