Showing results for 
Search instead for 
Did you mean: 

UI component select box on change event call ajax

UI component select box on change event call ajax

How can I add an event when changes select box dropdown value and I will trigger Ajax when change value in the dropdown,
Below is my code.

<fieldset name="sample_fieldset">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Attribute Information</item>
        <field name="attr">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">vendor\module\Model\Source\option</item>
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Select Attribute</item>
                    <item name="formElement" xsi:type="string">select</item>
                    <item name="source" xsi:type="string">splitattr</item>
                    <item name="dataScope" xsi:type="string">attr</item>
                    <item name="default" xsi:type="string">0</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">true</item>

Below is the output which created image (1).png

How can I get selected value in jquery


Re: UI component select box on change event call ajax

Hi @Pushpendra7 ,


Please check below url for adding ui component custom js and you can get the selected value and call ajax.


Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!