I’m trying to take input from a text field and use it to update data member $FavoriteColor using the member function ChangeColor($NewColor); without a page reload. Is AJAX equipped to access PHP classes?
Here’s the example class:
[code=php]
<?php
class TestClass
{
public $Name = “Joe”;
public $FavoriteColor = “Green”;
public function ChangeColor($NewColor)
{ $this->FavoriteColor = $NewColor; }
public function ShowInfo()
{ echo $this->Name . “‘s favorite color is ” . $this->FavoriteColor; }
}
$obj = new TestClass();
$obj->ChangeColor(“red”);
$obj->ShowInfo();
//output is “Joe’s favorite color is red”
?>
<input type=”text” id=”color”>
<input type=”button” onclick=”UpdateColor();” id=”submit”>
Theoretically, UpdateColor() would do this…
-Dave