Monday, March 22, 2010

city_select plugin to display list of indian city in dropdown list

city_select - city_select is the plugin which is basically used for to display the list of indian cities as a drop down list.

The implementation is simple

.script/plugin install git@github.com:abhishekpshukla/city_select.git


I have implemented it using jquery.


$("#user_state").change(function() {var id=('#user_state').attr("value"); $.ajax({url: "update_city/"+id, dataType: "script", type: 'get' })});

NOTE:
. "#user_state" is the dropdown list which contain the list of state name(I have consider the value of user_state as a FULL STATE NAME(for e.g. "Maharashtra") instead of STATE CODE).

Make a render file let say _city_select.erb and inside the controller render the _city_select.erb file and parse the selected state

Feel free to add a city if I am missing one.


Thansk