I am getting location details from database as a json response and values are coming correctly but my problem is the alignment of content string getting error like unterminated string literal ...
then i am displaying this details in google map info window..
var contentString = "<div><h4>Start Location : "+ locations[i].start_loc + "</h4>
<h4> Driver Name : "+ locations[i].driver_name + "</h4>
<h4> Driver Mob No : "+ locations[i].mob_num + "</h4>
<h4> Passenger Name : "+locations[i].passenger_name + "</h4>
<h4> Passenger Mob No : "+locations[i].mob_no + "</h4>
<h4> Cab Reg No : "+ locations[i].cab_reg_no + "</h4></div>";
infowindow.setContent(start_contentString);
infowindow.open(start_map, start_marker);
Please help me anyone....
Just add \\
after every line:
var contentString = "<div><h4>Start Location : "+ test + "</h4> \
<h4> Driver Name : "+ locations[i].driver_name + "</h4> \
<h4> Driver Mob No : "+ locations[i].mob_num + "</h4> \
<h4> Passenger Name : "+locations[i].passenger_name + "</h4> \
<h4> Passenger Mob No : "+locations[i].mob_no + "</h4> \
<h4> Cab Reg No : "+ locations[i].cab_reg_no + "</h4></div>";
Answer just to show alternative multiline...
var contentString = "<div><h4>Start Location : "+ test + "</h4>" +
"<h4> Driver Name : "+ locations[i].driver_name + "</h4>" +
"<h4> Driver Mob No : "+ locations[i].mob_num + "</h4>" +
"<h4> Passenger Name : "+locations[i].passenger_name + "</h4>" +
"<h4> Passenger Mob No : "+locations[i].mob_no + "</h4>" +
"<h4> Cab Reg No : "+ locations[i].cab_reg_no + "</h4></div>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.