0

I have a question, that i would like to send some array to jquery once someone clicked on specific element, i can see that i can not add array to any input, so i decided to encode array in json. But i am stuck there as i am not able to get that json data from that input field in jquery. I am getting that json data in jquery using field class name.

Please someone help as i am building a WP shortcode and i want to send all attributes to jquery.

Thanks in advance

1 Answer 1

0

You could use one of these. It would give you json data.

$data = json_encode( array('status' => 200, 'message' => 'success');
$result = wp_send_json_success( array( 'photo_id' => $photo_id_encode,'upload_msg' => 'Success' ) );
1
  • Thanks for the answer, but i have already found the solution as i was using input field to send json array to jquery instead now i am using hidden div and having json array as text of div. Thanks again for your help Commented Jun 23, 2017 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.