|
MP - 2008-02-11 18:26:17
Hi.
Situation:
I have class A wich have array. I need change this array with ajax. Exactly I need change one field of this one, only.
Without ajax on first I serialize object (into session), post form, unserialize object and after that I will change a field in array.
Ask:
Is possible change array field of object A with phpajax? I have to add new fields, update fields and delete fields of array.
I am going to use it in basket of e-shop...
Is possible to make any examle?
Cesar D. Rodas - 2008-02-12 19:02:16 - In reply to message 1 from MP
Hello,
What I understand for your example you have an array (which is your $_SESSION), and you want to modify one field of that array (ex. $_SESSION['foo']).
On the server:
<?php
class modify extends phpajax {
var $inputs="bar";
function main() {
$_SESSION['foo'] = $this->bar;
}
}
?>
Then in your client (html):
<a href="javascript:modify('the content')">Click me</a>
Or:
<input id="bar" value="the content">
<a href="javascript:modify()">Click me</a>
Please, let me know is this can solve your problem and if I understood well your little trouble.
Best regards
MP - 2008-02-16 20:12:50 - In reply to message 2 from Cesar D. Rodas
Thank you...
I think, I have solved my problem... Your reply helped me!
So, I have one question, now... Can you show roadmap for phpajax?
Greetings blacmoor...
MP - 2008-02-17 14:27:26 - In reply to message 3 from MP
Hello.
I am sorry I didnīt solve my problem... :(
If I tried create a new object in main() function, phpajax show error message with "[OBJECT ERROR]" text...
Here is sample of code:
//........................................................
class MYclass extends phpajax{
function input() {}
function main() {
$_start = new classStart(); //here is the problem
}
}
//........................................................
Is possible create new objects in this function?
Can you help me? Thanks...
Greetings blackmoor...
MP - 2008-02-17 14:45:49 - In reply to message 4 from MP
I forgot on this same problem with functions:
Here is sample of code:
//........................................................
class MYclass extends phpajax{
function input() {}
function main() {
aprint('products_span', my_test()); //here is the problem
}
function my_test(){
return "hello world";
}
}
//........................................................
If I run this script I will see an object error response.
Greetings blackmoor...
Cesar D. Rodas - 2008-02-17 16:51:26 - In reply to message 5 from MP
Hello,
You can instance any object there, the main problem may be that you want to instance a class that doesn't exists.
class MYclass extends phpajax{
function input() {}
function main() {
aprint('products_span', my_test()); //here is the problem
}
function my_test(){
return "hello world";
}
}
Here you have a bug, you are calling "my_test()" which is a function that doesn't exists. You have define a method "my_test()", so you must call it "$this->my_test()".
Best regards
MP - 2008-02-17 18:23:26 - In reply to message 6 from Cesar D. Rodas
ouuu
Thanks for corrections!! It were my mistakes ;)
What about roadmap?
Greetings blackmoor
|