hi. happy new year^^
I need your help....
I can't get value from ajax; how to get values from ajax.
my source is below...
phalcon
<?php
namespace App\Controllers\Test;
class GetController extends ControllerBase{
private $responseData = "";
public function initialize(){
$this->view->disable();
}
public function indexAction(){
$this->request->isAjax(); // this works. result is 1 in chrome console
echo 'hi'; // this works. result is hi in chrome console
print_r($this->request->getJsonRawBody()); // result is blank in chrome console
print_r($request->getJsonRawBody()); // result is Undefined variable: request in chrome console
print_r($this->request->getPost()); // result is blank in chrome console
print_r($request->getPost()); // result is Undefined variable: request in chrome console
print_r($this->request->getPost('request')); // result is blank
print_r($request->getPost('request')); // result is Undefined variable: request in chrome console
print_r($_POST); // result is blank in chrome console
javascript
$.ajax({
url : "/test/get",
method : "POST",
processData : false,
cache : false,
data : {
request : "hi1234"
}, // xmlDocument
dataType : "text",
success : function(data){
console.log(data);
}
});