質問

City list is loaded by changing State drop down. Every state is perfect except Texas. Texas have around 1500 data. it's the only reason why city drop down data is not populated for Texas. here is my code as zipped. Download

役に立ちましたか?

解決

I have found the error. The error is in your city data in the database. Some city name data has escape character i.e, " \ " .. which is destroying the json structure and your parser in jQuery is getting unable to parse the data.

There is two way to solve this...

  • You can clean up the data from database .. that is you have to find those city name which has escape character and remove the escape character and save. Example: "Dhaka\" to "Dhaka".

OR

  • You can use addslashes() PHP function in the ajax PHP file where you are making the select list option HTML. i.e, $city_list.="<option value='$row[id]'>".addslashes($row['city_name'])."</option>";

...... Lets do what you prefer. But, my opinion to use 2nd option.

Cheers. .. :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top