0

I am using a jQuery Chained Select Plugin.

But getting stuck loading the data dynamically to select options from my Expression Engine template. Seems pulling the value from the JSON url is causing the error, manually changing the mo'variable from url_title="{get:series}" to an entry url_title="test" makes the drop down work. What could be going wrong? How can I check what the URL is the plugin is outputting?

<form>
    <select id="mark-remote" data-variable="bar" name="mark">
        <option value="">--</option>
        <option value="bmw">BMW</option>
        <option value="audi">Audi</option>
    </select>
    <select id="series-remote" name="series">
        <option value="">--</option>
    </select>

    <button id="button-remote" type="submit">Button</button>
    <script>
        $(function() {
            /* For jquery.chained.remote.js */
            $("#series-remote").remoteChained({
                parents: "#mark-remote",
                url: "http://example.com/json",
                loading: "--"

            });
        });
    </script>
</form>

Expression Engine JSON template

{exp:http_header content_type="application/json"}

[
    {"" : "--",
    {exp:channel:entries channel="articles" dynamic="on" url_title="{get:series}" disable="categories|trackbacks|member_data|pagination"}
    {relatedarticle backspace="3"}
"{relatedarticle:url_title}":"{relatedarticle:title}", 
    {/relatedarticle}
    {/exp:channel:entries}
    }
]

JSON output (Adding this manually to the template loads the data perfectly)

[{"" : "--", "data":"data" , "data":"data"}]
2
  • Please, try to enable Protect Javascript on this template. – Sobral Dec 8 '14 at 11:52
  • Tried that but did not work :( – Thomas K Dec 8 '14 at 12:28
0

Works now, changing the variable to {get:mark} populates the series drop down. shew!

1
  • Hey Thomas, I'm working on something similar but using categories. I'm using EE3, mo variables, json, chained selects, exp:http_header, and I'm also have issue populating the second drop down. Would it be possible to expand on your example here? A link to see it working? Much appreciated! – Denny Smith Aug 22 '16 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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