Support

Account

Home Forums Backend Issues (wp-admin) Get the saved value from a dynamically loaded Select field using JavaScript API Reply To: Get the saved value from a dynamically loaded Select field using JavaScript API

  • 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": ""
                            }
                        ]
                    }
                ]
            }
        }
    }