mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
ajax call, controller, class, match result, return array inputs(example to return)
This commit is contained in:
parent
631170bfe9
commit
14b8379ccb
@ -642,6 +642,22 @@ if ($config['menu_type'] == 'classic') {
|
||||
if( $('#keywords').val() === ''){
|
||||
$('#result_order').hide();
|
||||
}else {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "text",
|
||||
data: {
|
||||
page: 'include/ajax/order_interpreter',
|
||||
method: 'getResult',
|
||||
text: $('#keywords').val(),
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to interpreter order", data)
|
||||
}
|
||||
});
|
||||
$('#result_order').show();
|
||||
}
|
||||
}
|
||||
|
@ -117,20 +117,20 @@ class OrderInterpreter extends Wizard
|
||||
/**
|
||||
* Method to print order interpreted on header search input.
|
||||
*
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getResult()
|
||||
public function getResult():array
|
||||
{
|
||||
// Take value from input search.
|
||||
$text = get_parameter('text', '');
|
||||
|
||||
$array_found = [];
|
||||
foreach ($this->pages_name as $key => $value) {
|
||||
if (preg_match('/'.$text.'/', $value)) {
|
||||
echo 'pene gordo';
|
||||
if (preg_match('/.*'.$text.'.*/', $value)) {
|
||||
$array_found[$key] = '<input id='.$key.'><a href="'.$this->pages_url[$key].'">'.$value.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return $array_found;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user