javascript - Jquery appending values to dropdown from select -
I am trying to return the values within my dependent dropdown within the livery. API / Dropdown Jason, all works fine Although the returned values are not populated in my dropdown, instead they are displaying [object object] instead.
Am I missing something?
$ (document) .ready (function ($) {$ ('# firstselect'). Change (function () {$ .get ("{{ Url ('api / dropdown')}}, {option: $ (this) .val ()}, function (data) {$ .Every (data, function (key, value) {$ ('# secondselect'). Append ($ ("& lt; option & gt; & lt; / option & gt;") .attr ("value", key) .text (value));}}}}}}});});
$. Each (data, function (Index, value) {// Make sure the value string is attached by placing a debugger here; // code attached;; $ ('# secondselect') attribute .attr ("value", key) .text (value);}); P> The code you posted $ (document) .ready (function ($) {$ ('# firstselect'). Change (function () {$ .get (" Api / dropdown ')}}, {option: $ (.) .val ()}, function (data) {$ .each (data, function (key, value) {/ ********** **************************************************************************************************** **************************************** Please make sure that the value is the string debugger; Console.log (value); / *************************************************************************************************** ********************* *************************************************************************** / $ ('# Secondselect') $ (attached. ("Lt; option & gt; & lt; / option & gt;") .attr ("value", key) .text (value);})} });});});
Comments
Post a Comment