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)
PHPjQueryAJAX

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RationalRabbit

ASKER
Thanks
leakim971

you welcome
Your help has saved me hundreds of hours of internet surfing.
fblack61