How to set PHP class property from JavaScript -
how set property or variable of php class javascript code uses it. class pretty basic, , looks this:
<?php class_exists('api') or die(); class classname extends someotherclass { public function __construct(... { parent::__construct('1.0', ... } public $publicvariable = "initblank"; public function init() { parent::init(); $this->set... $this->add... } public function somefunction() { ... ... homecoming array(... } } homecoming new classname($this);
and calling javascript code basic:
function classview() { this.var1 = ko.observable(0); this.var2 = ko.observable(''); } classview.prototype... classview.prototype... classview.prototype.clickbtn = function () { this.publicvariable = "myvalue"; ... ... };
is there way set $publicvariable property javascript code?
thank you.
php preprocessor means web server (e.g. apache) executes php , returns result client. therefore, impossible dynamically update php variables via client-side javascript.
however, can execute ajax request store variable on server somewhere , access php.
javascript php class properties getter-setter
No comments:
Post a Comment