{"id":672,"date":"2012-12-11T11:11:12","date_gmt":"2012-12-11T11:11:12","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=402"},"modified":"2016-09-10T14:53:59","modified_gmt":"2016-09-10T14:53:59","slug":"jquery-dropdown-population-after-ajax-request","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/jquery-dropdown-population-after-ajax-request\/","title":{"rendered":"Jquery Dropdown Population after ajax Request"},"content":{"rendered":"<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n        url = &quot;\/property\/realestate_statistics\/&quot;;\t\r\n\t\r\n\tlngCityId = $('#cboCityName').val();\r\n\t\r\n        $.post(\r\n\t  url,\r\n\t  {\r\n\t   &quot;act&quot; \t\t: &quot;GetCommonLocation&quot;,\r\n\t   &quot;CityId&quot; \t\t: lngCityId\r\n\t  },\r\n\t  function(responseText){\t\t\r\n\t   $('#cboLocation').html(responseText);\t\t\r\n\t   $('#cboPropertyType').html('');\r\n  \t   $('#cboPropertyType').append( new Option('Property Type',''));      \t\t\t\r\n\t   $('#cboPropertyType').val('Property Type');\r\n\t  }, \r\n\t  &quot;html&quot;\r\n\t);\r\n<\/pre>\n<p>I have a response text coming after changing city and this will be populated in second drop down<br \/>\ncboLocation. Now the third drop down should be repopulated based on property type at city by taking common location selected in to consideration. for that you should reset property type apart from  resetting cboLocation.<\/p>\n<p>To do so <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n        $('#cboPropertyType').html('');\r\n  \t$('#cboPropertyType').append( new Option('Property Type',''));      \t\t\t\r\n\t$('#cboPropertyType').val('Property Type');\r\n<\/pre>\n<ol>\n<li>$(&#8216;#cboPropertyType&#8217;).html(&#8221;) &#8211; To empty the Content of Drop down <\/li>\n<li>$(&#8216;#cboPropertyType&#8217;).append( new Option(&#8216;Property Type&#8217;,&#8221;)) &#8211; It should Contain only Property Type in Option so i am Appending that<\/li>\n<li>$(&#8216;#cboPropertyType&#8217;).val(&#8216;Property Type&#8217;) &#8211; It should point to only one option that exixts<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>url = &quot;\/property\/realestate_statistics\/&quot;; lngCityId = $(&#8216;#cboCityName&#8217;).val(); $.post( url, { &quot;act&quot; : &quot;GetCommonLocation&quot;, &quot;CityId&quot; : lngCityId }, function(responseText){ $(&#8216;#cboLocation&#8217;).html(responseText); $(&#8216;#cboPropertyType&#8217;).html(&#8221;); $(&#8216;#cboPropertyType&#8217;).append( new Option(&#8216;Property Type&#8217;,&#8221;)); $(&#8216;#cboPropertyType&#8217;).val(&#8216;Property Type&#8217;); }, &quot;html&quot; ); I have a response text coming after changing city and this will be populated in second drop down cboLocation. Now the third drop down should be repopulated&hellip; <a href=\"https:\/\/codethataint.com\/blog\/jquery-dropdown-population-after-ajax-request\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-672","post","type-post","status-publish","format-standard","hentry","category-jquery"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=672"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/672\/revisions"}],"predecessor-version":[{"id":1597,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/672\/revisions\/1597"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}