javascript - parent id lost on submit -
For some reason, when I submit my form after starting the changing event, the parent ID will now include the ID The database does not have to be inserted. Instead it includes 'Selection Event'? Do I miss something?
Form
& quot; Class = "form-control" id = "parent_id" name = "parent_id" & gt; & Lt; Options & gt; Select event & lt; / Options & gt; $ Foreach (Event :: All () as $ item) & lt; Option value = "{{$ item-& gt; id}}" & gt; {{$ Item- & gt; Title}} & lt; / Option & gt; @earnchach & lt; / Select & gt; & Lt; Div id = "child_id" & gt; & Lt; / Div & gt; JAVASCRIPT
$ (document) .ready (function ($) {$ ('# parent_id'). ( Function () {$ .getJSON ("{{url ('api / dropdown')}}, {option: $ (.) .val ()}, function (data) {if (data.success == true) ( $ ('# Busy'). ($), $ .eight (data, function (key, value) {$ ('# child_id'). Append ('' + value.name + '
As far as I understand that select of all your options are adding to the running time, post the value At the time of doing only the default option with one item If you use a hidden field as & lt; input type = "hidden" id = "hiddenvalue" & gt; & lt; / input & gt; and assign an event to the selected change that the selected values will be hidden in the field
$ ("# parent_id") ("Change", function () {var $ select = $ (this); $ ("# Hidden value") Val ($ select.val ());}); Instead of choosing to take value from hidden fields.
Hope it helps ..........
Comments
Post a Comment