Re: How to convert this PHP into JavaScript [message #173168 is a reply to message #173167] |
Fri, 25 March 2011 19:22 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 3/25/2011 2:59 PM, sheldonlg wrote:
> On 3/24/2011 12:50 PM, Jerry Stuckle wrote:
>> On 3/24/2011 10:23 AM, Oltmans 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!
>>
>> If you want to write javascript, you should ask in a javascript
>> newsgroup.
>>
>
> No Jerry, not this time. He has a PHP array and he wants to use that PHP
> array to generate a script in javascript. That means that knowledge of
> BOTH is required.
>
> This is more properly asked here in this PHP group than in the
> Javascript group. Everyone here also knows at least SOME Javascript. The
> reverse is not true for the Javascript group. People there may not know
> ANY PHP (though most seem to).
>
No, Sheldon, he needs to be in comp.lang.javascript - where some of the
people there know PHP.
The first thing he needs is the appropriate javascript he needs - i.e.
hand coding it. The generating the appropriate javascript from the
array is simple.
Now, if he would have said "I have this javascript I need to generate
from this PHP array...", I would agree this is more appropriate.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|