Hi John and thank you for taking the time to answer.
I am using wp_localize_script()
when I’m getting the course description alternatives, but I don’t know how, in that php script (that responds to the ajax call), to get the value of the Select field for that specific post.
This is how it’s set up:
{
"key": "field_61d5a151263bf",
"name": "optional_block",
"type": "flexible_content",
"layouts": {
"layout_61d5a167e8fda": {
"key": "layout_61d5a167e8fda",
"name": "course_teaser_block",
"sub_fields": [
{
"key": "field_61d592c4129c9",
"name": "course_teasers",
"type": "repeater",
"sub_fields": [
{
"key": "field_61d59682129cf",
"name": "course_teaser_course",
"type": "post_object",
"post_type": [
"mscourse"
],
"return_format": "id",
},
{
"key": "field_61d594db129cb",
"label": "Kurspuff",
"name": "course_teaser_num",
"type": "select",
"ui": 0,
"return_format": "value",
"ajax": 0,
"placeholder": ""
}
]
}
]
}
}
}
I turned out I couldn’t use it anyway, so don’t bother this issue 😊
I did manage to get the info I (thought I) was looking for by looping through the keys
Object.keys($input).forEach(key=>{console.log($input[key])})
In case anyone would wonder.