1 (edited by syn42 2011-12-21 9:27:35 AM)

Topic: Xajax and array...

Hello, i have trouble when i try to pass array in xajax function... like that :

<?php
$retour .= '<input type="submit" id="genererMatchs" value="Launch matchs" onclick="xajax_xajaxCreateMatchs( '.$infoFeuilleMatch.'); return false;" />'; 
?>
function xajaxCreateMatchs($infoFeuilleMatch)
{
    $reponse = new xajaxResponse();
            
    $reponse->alert($infoFeuilleMatch[0]["nb"]." players");
        
    return $reponse;
}

The alert says "f players" ...... it must be "4 players"
$infoFeuilleMatch is a matrix array

any idea? Need your help...
Many thanks

Re: Xajax and array...

Hello Syn42

perhaps you try to use
xajax_xajaxCreateMatchs( xajax.getFormValues('id_of_the_html_form'))

otherwise you can use json string for the $infoFeuilleMatch.
such as

{
'var1':'anplayer',
'var2':'anplayer'}

Re: Xajax and array...

Thanks, i'm not in a form... so i try json_encode but my var is empty...
I found a tips... i make a string and I get my value with explode on the other side... I know it is not very clean but.... works..