Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

laravel data showing in single option instead of multiple option from json array

//Your data structure is fine. The issue is that you're not creating multiple option elements, you're only creating one. This part is off:

$("#cityPicker").append('<option value="' + value
                            .districts + '">' + value.districts + '</option>');
                        }
//what you want to do is create an option element for each district, as follows:

for (const district of value.districts) {
  $("#cityPicker").append('<option value="' + district + '">' + district + '</option>');
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript array includes time complexity 
Javascript :: pass mltiple valuesthorugh context in react 
Javascript :: React Router rendering blank pages for all components 
Javascript :: Javascript - Dependency between arguments of partial applications 
Javascript :: javascript For some reason my content within an array is not printing out to the screen 
Javascript :: Passing JSON to Javascript in Laravel – but JS is converting the JSON to HTML Entities 
Javascript :: getting xml from response, make sure server returns valid xml and the "content-type" header is set 
Javascript :: node js delete folder 
Javascript :: AngularJS get ETag header from $http.put request 
Javascript :: call method from parent 
Javascript :: angularjs How to sort a specific value in a map 
Javascript :: createaction ngrx example 
Javascript :: Json response reactnative fetch login data 
Javascript :: javascript unique grouped arrays 
Javascript :: RegEx Pattern Validations failing on html input 
Javascript :: settimeout and create directory nodejs 
Javascript :: Get value by key from json array 
Javascript :: ant design rtl 
Javascript :: get range of items in list javascript react native 
Javascript :: assign single value to multiple variables in React js Or javacript 
Javascript :: three.js animate object regardless screen fps 
Javascript :: convert json date to java date 
Javascript :: Make Floating label TextInput with password show/hide in react native 
Javascript :: map sord elo 
Javascript :: javascript palindrome check 
Javascript :: convert .js to .ts 
Javascript :: nestjs prisma controller 
Javascript :: js beutify node.js 
Javascript :: mongoose export collection 
Javascript :: jquery issue stack 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =