Hi Emil
thanks for your message, i was getting crazy last 2 days, i was using
file json.js that i renamed to jsonjscript.js from www.json.org ,  cos
i have json.js from jquery.com. I getting erros cos they are not
compatible. I just needed to use json.js  from jquery.  and the right
syntaxis:  $.parseJSON(StringJ) .
I don't need really use $.getJSON cos I only need to retrieve all my
curriencies recors one time then pass to multidimensional javascript
array.

the right is:
        echo " StringJ= '" . $myjson . "';";
        echo " var arrayCambios = $.parseJSON(StringJ);";

i hope this be useful
david

On Jun 9, 1:34 pm, Emil Ivanov <[EMAIL PROTECTED]> wrote:
> A little correction:> Then in javascript:
> > var jsArray = $.getJSON('/test.php');
>
> Has to be
> Then in javascript:
> $.getJSON('/test.php', function (jsArray) {
>
> });
>
> On Jun 9, 7:32 pm, Emil Ivanov <[EMAIL PROTECTED]> wrote:
>
> > Once you encode the array to JSON in php you just have to pass it to
> > the javascript, not decode it:
> > // test.php
> > $aCambios = mysql_fetch_all ($resultCamb ) ;
> > $myjson = $json->encode($aCambios);
> > // echo "<script>"; Note that this is commented
> > echo $myjson;
>
> > Then in javascript:
> > var jsArray = $.getJSON('/test.php');
>
> > And it jsArray you should have the php array stored as javascript.
> > (The examples are untested)
>
> > Regards,
> > Emil Ivanov
>
> > On Jun 9, 6:43 pm, cheridav <[EMAIL PROTECTED]> wrote:
>
> > > Hi
>
> > > i'm using Mark pluging json.js but i get error when i  use ParseJSON,
> > > may i'm not writting right the syntaxis.
> > > I get in a array all the arrows from a table, then i convert to json
> > > (using json.php) , and tI ry to convert to an array in javascript.
>
> > >         $aCambios = mysql_fetch_all ($resultCamb ) ;
> > >         $myjson = $json->encode($aCambios);
> > >         echo "<script>";
> > >         echo " var arrayCambios = StringJ.parseJSON('" . $myjson . "');";
>
> > > thanks in advance.
> > > David

Reply via email to