Ajax Tutorial: Dynamic Loading of ComboBox using jQuery and Ajax in PHP

Written By: Zeeshan Rasool  |  Posted In: AJAX, JQuery, PHP, Web Development



Here is a script for beginners to create a dynamic loading of dropdown. Simple solution which is created by jQuery.

PART TWO IS HERE

Table Structure

CREATE TABLE IF NOT EXISTS `ajax_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(50) NOT NULL,
  `pid` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) 

get_child_categoires.php


	
		
	

HTML

Select Category

Select Sub Category


If you enjoyed this post, please consider leaving a comment below or subscribing to the RSS feed to have future articles delivered to your feed reader. You can also follow us on Facebook or Twitter @99Points


Zeeshan Rasool is the founder and editor of this blog. Beside this, he is an experienced PHP web developer and freelancer. He loves to create best and interactive web apps. You can follow him at twitter @99_Points and facebook OR drop an email at 99points.info@gmail.com

67 to “Ajax Tutorial: Dynamic Loading of ComboBox using jQuery and Ajax in PHP”

  • Simon January 23, 2012 at 6:51 pm

    love it :D

  • venky February 27, 2012 at 7:02 am

    hi ,thanks, i need to do styles for this select box, it possible?? any tutorial for tht??

  • absfrm April 30, 2012 at 7:23 am

    thanks a lot.
    How can i get sub categories of child?
    ex: after select main cat , next combobox show me children’s of it.and how can i show children’s of selected child in combobox?

    please help me.thanks

  • Fizal May 30, 2012 at 12:38 pm

    Jazakallah khair (May Allah grant you goodness)

  • biji June 29, 2012 at 10:05 am

    Thanks ZeeShaN! How can I use values, as they have all name=”sub_category”?????? what can separate them from each other?

  • Fazal July 28, 2012 at 10:24 am

    Thanks Dear

  • Harish August 14, 2012 at 7:45 am

    Hello,

    Its working fine for me but i’m unable to send the sub category value to mysql after submit can you give me the code please

    Regards
    Harish

  • dileep October 22, 2012 at 8:14 am

    Thanks bro ..

    here how to store a sub category contents on data base.. please help me..

    thanku…

  • Msela November 29, 2012 at 7:56 pm

    Maybe there is a problem with the connectivity of the database in your php code

  • Razik December 13, 2012 at 6:49 am

    Hi ZeeShaN,

    Its perfectly working for me.

    It help me for my website.

    Thanks a lot…….

  • Godders February 11, 2013 at 4:29 pm

    Hi, the script works fine in Chrome and Firefox, but in IE9 32 and 64 bit the select sub category doesn’t appear and the “working” symbol keeps rolling around.
    Using your demo on the internet the script works ok though.
    Anything I can look at?
    Thanks

    Paul Godfrey

  • Paul Silver February 12, 2013 at 6:32 pm

    thanks men

  • JLM February 19, 2013 at 4:32 pm

    Same issue than Godders. Part 1 and Part 2 works fine in Firefox, but both desn’t in IE … Could you help please ?

  • JM March 13, 2013 at 2:06 pm

    how to save the value of 2nd combo box? any suggestion?

  • JM March 14, 2013 at 12:38 am

    hello it works fine but it cannot save the value of second combo box to mysql using PHP .

  • Jamy March 25, 2013 at 8:56 pm

    Thank you very much.

  • Andreza April 16, 2013 at 6:54 pm

    Hi,

    I have created the dropdown with the categories and subcategories, like in the example. But, how can I show the results in the content area of my site?

    Thanks.

Post comment


Email Subscriber!

Be the first to know about new updates


Advertisement

Categories

Popular post

Recommend