[horde] Question about Ajax.Request

Mike Poznecki poz_sa at yahoo.com
Tue Apr 10 16:48:57 UTC 2018


 

    On Tuesday, April 10, 2018, 1:39:28 AM CDT, Ralf Lang <lang at b1-systems.de> wrote:  
 
 Am 09.04.2018 um 21:32 schrieb Mike Poznecki:
>
> I need to pass an array and a string to my php page. But I cannot figure out how to do this. Here is my code:
> Javascript: (myVar is an array.)
> function processData(myVar){  new Ajax.Request('myPage.php', {    type: 'post',    data: {myCmd: 'ProcessIt', addData: myVar},  onSuccess: function(transport) {    return transport.responseText;  }  });}
> PHP:
> <?phpif (empty($_POST)){ // $_POST is always empty.  Even though the type is array.}
>
>
> As my comment says, $_POST is always empty. I have tried many ways to get some values out of it, but it is just empty.
> Can someone show me what I am doing wrong?
>
>
>
>
Hi Mike, if you want data from Horde, best do it this way:

Call HordeCore.doAction() from the client. doAction adds
security/authentication related stuff to your bare ajax call.

It will call $app/lib/Ajax/Application/ and, implicitly, a Handler. The
handler needs to have a method name corresponding to the command used in
doAction. Return an array/hash of serializable data and doAction will
receive a JSON structure including this data.

I think there is a horde wiki entry explaining this ajax mechanism in
detail.
-- 
Horde mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: horde-unsubscribe at lists.horde.org

I have tried to do it that way, but have been unable to figure out what all needs to be done to make that work.There is very little documentation for developers on Horde.




  


More information about the horde mailing list