php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Thursday, January 18, 2018

How To Populate JSON Data In Select Dropdown Using jQuery?



$DatabaseServer = "localhost";

$DatabaseUsername = "root";

$DatabasePassword = "root";

$DatabaseName = "demo";

$Connection = mysqli_connect($DatabaseServer , $DatabaseUsername ,  $DatabasePassword , $DatabaseName);


if($Connection=== false){

    die("ERROR: Could not connect. " . mysqli_connect_error());


$SQL = mysqli_query($Connection, "SELECT * FROM User");

$Result = array();

while($Row = mysqli_fetch_assoc($SQL))    {

       $Result[] = array(

          'FirstName' => $Row['FirstName']            



    echo  json_encode($Result);



JSON Array:





<script language="JavaScript" src=""></script>


$(document).ready (function () {

            $.getJSON ("ViewUserData.php",

                function (json) {

                    for (var i = 0; i < json.length; i++) {

                        $("#UserID").append("<option>" + json[i].FirstName+ "</option>");







<select id='UserID'>

//Your Json Array comes here




MySQL: Run these two queries

  `UserID` int(12) NOT NULL,
  `FirstName` varchar(48) NOT NULL,
  `LastName` varchar(48) NOT NULL,
  `Email` varchar(128) NOT NULL,
  `City` varchar(48) NOT NULL

INSERT INTO `user` (`UserID`, `FirstName`, `LastName`, `Email`, `City`) VALUES
(1, 'Ram', 'Sri', '', 'Delhi'),
(2, 'Krishna', 'Vasudev', '', 'Delhi');


  1. This comment has been removed by the author.

  2. Buy perfect money in India @Rs.70/- per pm Sell @Rs.58/- per pm,CALL 08054019105, Chandigarh, 160017


    Buy/Sell Perfect Money At Reasonable Rates. We Provide Perfect Money At best Rates.
    We also sell buy Perfect Money, neteller and Bitcoin.

    Call us : +91 9517544444

    Gtalk : garrysingh1598


  3. Most of the students who look for an academic writing solution simply search for such on a site on the most widely used search engine and select anyone firm from the top websites there.But little do they know that going through a review of such websites will give you much insight about it which you can’t know by simply visiting it.
    All Assignment Help review

  4. Thanks for the great writeup. This the fact is once were some sort of pleasure bank account this.Commercial Led Lighting

  5. June Florist - Same day flower delivery singapore. Call June Florist for floral arrangements for wedding, decorations for conferences, hand banquet decorations, Flower Box, table flower arrangement & more. Tel: +65 6282 7555
    online flower shop singapore
    online flower delivery

  6. Lighting Warehouse Sydney Eye-catching element of written content. I merely came across your own web site and accession capital to say that we receive essentially liked account your current blog page discussions

  7. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    Webdesining course in chennai


  8. Hi guys, It’s always the first and important step for electric-guitar-beginners to get their first “right” BEST electric guitar. Because that guitar will follow us through our first stage in the guitar world. You know that since you’re reading this topic and haven’t yet picked a guitar randomly in a store, on the internet or recommended by some friends.

    if you want more just look here Studio Microphone

  9. Blog của bạn all posts messages is very exclusive and good for the user because when you have read your blog look the symbol is not allowed for me. I want to thank thank you. Most priority is you have a bookmark your web to update the future.
    hotmail login

  10. This is really great work. Thank you for sharing such a good and useful information here in the blog.

    Are you using roadrunner mail service or facing Roadrunner Email Problems and want help. just dial our customer service number +1-888-338-6033

  11. I want to say thanks to you. I have bookmark your site for future updates.
    Kindle won't connect to wifi

  12. Thanks for a marvelous posting! I actually enjoyed reading it, you can be a great author.I will be sure to bookmark your blog and definitely will come back later on. I want to encourage you to definitely continue your great job, have a nice afternoon! digital marketing trends

  13. Hey would you mind letting me know which web host you're working with? I've loaded your blog in 3 different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good hosting provider at a reasonable price? Thanks, I appreciate it!Amaron Inverter in Chennai

  14. Java Assignment Help
    Many times students are tensed for their projects and assignments, so at that time they can take online assignment help to complete it on time. There are experts available online who prepare the perfect assignment for you.

  15. you can go through AllAssignmentHelp reviews. It will help you to know about the services, and it will help you to know whether that site is reliable or not. This is a way of understanding the opinion of users, and it helps the website to maintain its functionality and reliability.

  16. Thanks for sharing about "How To Populate JSON Data In Select Dropdown Using jQuery?" Your post is really helpful for PHP users. I hope you will share another post for your readers.
    Kindle Fire Wifi Connection Failure

  17. Thank you for sharing this resource with me and the world. Wish you always reviews

  18. is a set of desktop applications, which is widely used products for the home as well as an office. Microsoft office gives the freedom of writing documents, blogs, letters and with the use of Microsoft office PowerPoint one can prepare a presentation also.

    office Setup
    Daily Helps

  19. Office Setup is a software which is used by almost all company and business and even by individuals For all their office activities or for personal use. It has excels, word, and ppt as their constituent are most widely used apps. For any concern and help just visit website for office help and key activation. You can do it by yourself if you know how to install office setup on your PC or Mac or you can call third party companies as well who can do it on your behalf.

  20. Assignment writing services are providing our experts. Fully guide and help writer your assignment. Our experts are available anytime helping you. Direct hire at our website

  21. Ireland assignment help provides the best assignment help to all students of Ireland. We offer the outstanding assignment writing help services by assignment helper at an affordable price. So, students can get good marks and also impress their college and universities mentors, so, email us at

  22. Amazing Post. If you are dealing with any kindle issues then contact Kindle Help Guide expert team. You can call on our toll – free kindle helpline number USA\Canada: (+1) 8889494666, UK: (+44) 8000418324 or visit our website kindle help guides.

  23. Hey there! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading your posts. Can you recommend any other blogs/websites/forums that cover the same topics? Thank you!e-commerce website

  24. Thanks for the post I actually learned something from it. Very good content on this site Always looking forward to new post. Digital Signature Certificate

  25. Good day! I know this is kinda off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having problems finding one? Thanks a lot!
    Build the Content

  26. I think this is among the most vital information for me. And i'm glad reading your article. But should remark on some general things, The website style is perfect, the articles is really excellent : D. Good job, cheers
    advertising on social media platforms

  27. It's best to take part in a contest for top-of-the-line blogs on the web. I'll recommend this site!
    digital marketing promotions

  28. Thanks For Sharing This, Very Interesting And Helpful Support Provide By this blog. Apply Class 3 Digital Signature Certificate

  29. Is it accurate to say that you are confronting
    Norton Error 8504 102 and unfit to begin the item? You should simply fix this blunder b interfacing the knowledgeable techniques. You can utilize group watcher to give the specialists a chance to fix basic framework issues and few of the incorporate framework organizing, reinforcement, cleaning, and recuperation.

  30. I'm really enjoying the design and layout of your blog. It's a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Fantastic work!
    digital marketing landscape

  31. There are so many collections of jumpsuit at You can buy here different types of dresses for women’s.
    Dress and Jumpsuit Collection
    Online Women Clothing Delhi


  32. thanks for your information really good and very nice web design company in velachery

  33. Thanks for good posting.If you are dealing any kind of issues regarding to translation.Our professional linguist expert emphasize to make effective,error free translation.Translation work by Singapore translators is always appreciable,rewardable.

  34. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.web design company in velachery

  35. Excellent and nice post. It will beneficial for everyone. Thanks for sharing such a wonderful post.

  36. Excellent and nice post. It will beneficial for everyone. Thanks for sharing such a wonderful post.

  37. When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove people from that service? Appreciate it!
    marketing agency in singapore

  38. Allassignmenthelp is your academic caretaker. Our online assignment assistance is one of the most sought after in the US and other countries and you should give us a chance to assist you. Free Plagiarism Checker Turnitin

  39. This comment has been removed by the author.

  40. Hope you will keep on offering good content like this more often. I feel more and more people should know about this. Also, I agree on most of the points you have made.
    Finance Assignment Help

  41. I enjoy kinds very own post. It will be respectable to get a single narrative inside and outside of the core of this distinctive core specialized niche will likely be commonly knowledgeable.
    how to write a good college essay
    good college essays
    college essay tips

  42. Lucky Patcher smile could be a must-have hacking app for all the crazy gamers is Lucky Patcher Apk. This app helps in modifying most of the android games so the games will be enjoyed to the fullest you can also check How to Use Lucky patcher.


More Posts