Link to home
Start Free TrialLog in
Avatar of RationalRabbit
RationalRabbit

asked on

Send PHP array to script via Ajax using jQuery

I have a PHP array
$D = array("Key1"=>"Value1","Key2"=>"Value2") etc.
I need to pass this to a PHP script using jQuery AJAX.
What is the best method to do this?
I know that json_encode should work, but not sure how to implement it in the data definition, which is also sending other variables
tried data: {Var1; "Value1", Var2: "Value2", DArray: <?PHP json_encode($D) ?>} (among other things)
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RationalRabbit
RationalRabbit

ASKER

Thanks
you welcome