Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

populate dropdown using jquery from database

Use a string to store your option, and then append it to the select tag. Then, please check that data is there in the val.

$.getJSON("get-data.php?dat=driver",function(data){
    var stringToAppend = "";
    $.each(data,function(key,val) {

       stringToAppend += "<option value='" + val.id + "'>" + val.id + "</option>";

    });

    $("#night_Shift_text").html(stringToAppend);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript check if file exists on server 
Javascript :: check if js property exists in class 
Javascript :: promise in forloop 
Javascript :: upload multiple images cloudinary 
Javascript :: discord.js ban command 
Javascript :: capitalise first letter js 
Javascript :: javascript htmlentities 
Javascript :: sticky navbar in react 
Javascript :: js index sorted 
Javascript :: node js starting template 
Javascript :: npm stylelint 
Javascript :: teste 
Javascript :: how to get multiple checkbox value in jquery 
Javascript :: jqurey text contains selector 
Javascript :: trigger play video jquery 
Javascript :: read json file into object javascript 
Javascript :: deprecation warning: value provided is not in a recognized rfc2822 or iso format. moment construction falls back to js date(), which is not reliable across all browsers and versions 
Javascript :: get number of days between two dates mongodb query 
Javascript :: nesting react js 
Javascript :: users api testing 
Javascript :: function palindrome javascript 
Javascript :: how to add numbers in an array in javascript 
Javascript :: javascript early break reduce() method 
Javascript :: convert date to readable format javascript 
Javascript :: js sting first letter 
Javascript :: change theme in react-toastify 
Javascript :: jquery get value of input submit 
Javascript :: javascript string interpolation 
Javascript :: jquery find div with data attribute value 
Javascript :: sh: /Users/ahmedqadri/Desktop/Projects/stockNotesAPP-frontend/node_modules/.bin/react-scripts: Permission denied 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =