我想知道是否有人可以指出我正确的方向,我正在使用Google地图试图为用户设置指定的邮政编码区域,如果我硬编码它的经度和经度就像这样完美;
var triangleCoordsLS12 = [
{lng: -1.558585, lat: 53.796545},
{lng: -1.558585, lat: 53.796545},
.....
];
Run Code Online (Sandbox Code Playgroud)
但是我试图从PHP数据库获取PHP和JSON这样的信息;
$.ajax({
type:'POST',
url:'test.php',
success:function(data){
var resultArray = JSON.parse(data);
for (var i=0; i<resultArray.length; i++) {
var triangleCoordsLS12 = new google.maps.LatLng(resultArray[i].lat, resultArray[i].lng);
if(location.uname == 'John Smith'){
bermudaTriangleLS12 = new google.maps.Polygon({
paths: triangleCoordsLS12,
strokeColor: '#ff0000',
strokeOpacity: 0.8,
strokeWeight: 1,
fillColor: '#ff0000',
fillOpacity: 0.30
});
bermudaTriangleLS12.setMap(map);
} else if(location.uname == 'Bruce Brassington'){
bermudaTriangleLS12 = new google.maps.Polygon({
paths: triangleCoordsLS12,
strokeColor: '#FFcc00',
strokeOpacity: 0.8,
strokeWeight: 1, …Run Code Online (Sandbox Code Playgroud) 我知道有一些类似的线程,但没有一个对我有任何帮助,我正在尝试通过Java创建XML文件,但我在这条线上不断看到这个错误
doc = db.parse(is);
,有人可以请告诉我我要去哪里错了?错误:-
Severe: [Fatal Error] :2:2: The markup in the document following the root element must be well-formed.
Severe: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 2; The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:348)
at com.digivote.digivote.XmlServlet.doPost(XmlServlet.java:194)
Run Code Online (Sandbox Code Playgroud)
我的代码:
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
String level = request.getParameter("level");
String add = request.getParameter("add");
String addCat = request.getParameter("addCat");
String addQuestions = request.getParameter("addQuestion");
String add_multiChoice = request.getParameter("add_multiChoice");
try
{ …Run Code Online (Sandbox Code Playgroud)