|
Posted by theiviaxx on July 17, 2008, 1:31 pm
Please log in for more thread options
> Hi,
>
> I make a AJAX call to PHP and get back a string to my javascript
> function that looks like this:
>
> (0,0)-(1,1)-(25,32)
>
> In my javascript i break the string on the "-" character into an array
> like this:
>
> [(0,0)] [(1,1)] [(25,32)]
>
> I check the length of the string in my array at the first position and
> it says the length is 7.
> I do a length of a hardcoded string "(0,0)" and it is of length 5.
>
> If I do a search of my string and find the position of the "("
> character is says it is at postion 2.... this is quite messed up.
> Does any one have any idea what is happening here?
>
> Thanks,
> Jeremiah
not sure what exactly is happening, but a better method would be to
encode the results from php in JSON, then decode it on the javascript
end. That way you dont have to do the splits and the integrity of the
data is maintained.
|