2015-04-28 86 views

回答

5

我建议使用:

https://github.com/umpirsky/country-list

它可以让你以不同的格式的国家名单(文字,JSON,PHP ...)

或者,如果你想只是一个快速的HTML列表,然后去:

http://www.textfixer.com/resources/country-dropdowns.php

你可以从字面上只需将这些值复制粘贴到您想要的任何位置,或者您可以调用该页面。

+0

非常感谢你kamal。 –

+0

好卡迈勒我需要插入数据库中的所有国家,因为我必须在PHP中使用它? –

0

在Struts2你可以得到它 - 例如,

<s:select name="name" headerKey="-1" 
list="countryList" id="country" 
value="%{countryList}" 
></s:select> 

在jQuery中,你将有通过一个AJAX调用来获取列表,并遍历它 例如,

$.ajax({ 
      url: 'rcmidAuditTrail.action', 
      type: 'GET', 
      async : false, 
      dataType: 'json', 
      error: function(data) { 
       console.log('error'); 
      }, 
      success: function(list) { 

var html = '<select>' 
       $.each(list,function(i,value){ 
        html+='<option>'+value+'</option>'; 
       }); 
$('dropdownId').html(html); 
      } 
     }); 
+0

谢谢你waqar –

相关问题