An error occurs when trying to send a request
AJAX handler ‘onSubmitContactForm’ was not found. 500
callback.htm
[send]
==
app.js
oc.request('#' + $(e).attr('id'), 'onSubmitContactForm', {
success: function (json) {
console.log(json);
},
error: function (jqXHR, textStatus, errorThrown) {
console.table(jqXHR, textStatus, errorThrown);
}
});
Plugin.php
class Plugin extends PluginBase
{
/**
* pluginDetails about this plugin.
*/
public function pluginDetails()
{
return [
'name' => 'Обратная связь',
'description' => 'Обратная связь с отправкой на email',
'author' => 'del',
'icon' => 'icon-leaf'
];
}
/**
* registerComponents used by the frontend.
*/
public function registerComponents()
{
return [
'del\Callback\Components\Send' => 'send',
];
}
}
Component file Send.php
class Send extends ComponentBase
{
public function componentDetails()
{
return [
'name' => 'send Component',
'description' => 'No description provided yet...'
];
}
/**
* @link https://docs.octobercms.com/3.x/element/inspector-types.html
*/
public function defineProperties()
{
return [];
}
public function onSubmitContactForm(Request $request){
return response()->json($request->all());
}
}