Re: How to convert this PHP into JavaScript [message #173147 is a reply to message #173146] |
Thu, 24 March 2011 15:03 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma:
|
Senior Member |
|
|
El 24/03/2011 15:23, Oltmans escribió/wrote:
> Hi PHP gurus, I hope you're doing well.
>
> I'm trying to convert a PHP script into JavaScript. I'm posting here
> because I don't know much PHP and I hope someone among you can help.
> Here is the PHP
>
> array(
> 'abc' => '1 AND (2 OR
> 3)', // Define how to
> use the following criteria
> 'def' => array('marketing_campaign_id', 'status',
> 'status'), // Filter by these three criteria
> 'ghi' => array('eq', 'eq',
> 'eq')
> );
>
>
> I need to convert above into JavaScript object which looks like
>
> {
>
> 'abc' : '1 AND (2 OR 3)'
> }
>
>
> but I don't know how to convert
>
> array('marketing_campaign_id', 'status', 'status')
>
> into equivalent JavaScript. Can someone please let me know how to
> convert above into JavaScript? I will really appreciate your help in
> this regard. Thanks!
http://php.net/json_encode should do the trick
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|