我有一个问题,ajax调用返回一个json。 我用这种方式构造json文件:
$hotel_array2 = array();
.....
$hotel_array2['name'] = str_replace('\'', '', $hotel->HotelDetails->Name);
....
array_push($arr_return['hotel'], $hotel_array2);
echo(json_encode($arr_return));
ajax调用是这样的:
$.ajax({
url: site_url_veturis,
type: "GET",
async: true,
data: window.location.search,
dataType: "json",
timeout: 50000,
success: function(data) {
},
error: function(data) {
}
})
奇怪的问题是,如果我用firebug看到响应中的响应json是:
{"hotel":[{"id":"17911","provider_name":"veturis","provider":"veturis","session":"","name":"Thistle Liverpool
City Centre, Atlantic Tower","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name"
:"","area_code":"","address":"CHAPEL STREET ","description":"HOTEL: This hotel and was built in 1975
. Was renovated in 1999, has 12 floors, 225 rooms, 217 double rooms and 2 suites. Clients have available
a lobby with a reception and lifts. \n\nSITUATION: This urban hotel, is located in a main street. It
is in a tourist area. 500 metres away, clients can find restaurants, bars and nightclubs. 1 kilometre
away, there are shops. \n\nROOM: The comfortable, en-suite rooms. They have a hairdryer, a direct line
telephone, satellite or cable television, a radio, a fridge, a minibar, fitted carpet, a safe-deposit
box and a central heating system. \n\nMEALS: Regarding gastronomy, the establishment has a buffet breakfast
and \u00e0 la carte or set-menu lunch and dinner. Dietary restrictions can be accomodated and special
dishes made. \n\nPAYMENT METHODS: Accepted payment methods are American Express, Visa, Eurocard, Mastercard
and Diners Club.","photo":"http:\/\/hoteles.veturis.com\/photos\/17\/17911_15.jpg","latitudine":"53
.4076538","longitudine":"-2.9936891","max_age_infant":"0","max_age_child":"12","status":"","currency"
:"EUR","order":"10000000","distance":"0.16","markup_agency":"15","type":"hotel"},{"id":"20770","provider_name"
:"veturis","provider":"veturis","session":"","name":"Campanile Liverpool","rating":2,"nation":"97","city"
:"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"CHALONER STREET - QUEENS
DOCK ","description":"HOTEL: This tourist hotel. Was built in 1990, has 100 rooms and 2 floors. Customers
have available a reception, a cosy bar, a restaurant, a conference room, internet, a laundry service
and a car park. \n\nSITUATION: It is situated near the historic harbour Albert Docks. This inviting
hotel, is a few minutes walk from the city centre, where you can find shops, leisure areas, monuments
and tourist points of interest. \n\nROOM: The rooms are cosy and they have an ensuite bathroom with
hairdryer. They have a direct line telephone, a radio and a central heating system. \n\nPAYMENT METHODS
: The establishment accepts American Express, Visa and Mastercard.","photo":"http:\/\/hoteles.veturis
.com\/photos\/20\/20770_4.jpg","latitudine":"53.3949623","longitudine":"-2.9839790","max_age_infant"
:"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"1.57","markup_agency"
:"15","type":"hotel"},{"id":"21903","provider_name":"veturis","provider":"veturis","session":"","name"
:"Britannia Adelphi","rating":3,"nation":"97","city":"394","nation_name":"","city_name":"","area_name"
:"","area_code":"","address":"RANELAGH PLACE , L3 5UL","description":"HOTEL: Urban and was built in 1914
. It has 6 floors, 402 rooms, 27 single rooms, 373 double rooms and 2 suites. In the establishment entrance
guests are offered a lobby with elevators, a reception with a safe deposit box, a currency exchange
, a car park and a garage. Customers have at their disposal a pub, a bar, a restaurant with highchairs
and internet. Some services offered by the establishment are room service and a laundry service. \n
\nSITUATION: This urban hotel, is situated in the city centre of Liverpool. 3 minutes away, guests can
find the Lime Street Station. \n\nROOM: The rooms comfortable, en-suite with hairdryer. They have a
direct line telephone, satellite or cable TV, a radio, internet, fitted carpet, a central heating system
and a safe-deposit box. \n\nFACILITIES: Customers have at their disposal a swimming pool, a bar, parasols
, a jacuzzi, a sauna, a solarium, a Turkish bath and a massage service. Clients can enjoy activities
such as squash and do aerobics. The establishment also has a gym. \n\nPAYMENT METHODS: Accepted payment
methods are American Express, Visa, Eurocard, Mastercard, Diners Club and EC. \n\nOTHERS: Regarding
gastronomy, clients can enjoy all meals in buffet form, \u00e0 la carte or set-menu lunch and a set-menu
dinner.","photo":"http:\/\/hoteles.veturis.com\/hotel-Britannia-Adelphi-F21903_1.jpg","latitudine":"53
.4051056","longitudine":"-2.9796340","max_age_infant":"0","max_age_child":"12","status":"","currency"
:"EUR","order":"10000000","distance":"0.87","markup_agency":"15","type":"hotel"},{"id":"40472","provider_name"
:"veturis","provider":"veturis","session":"","name":"Jurys Inn Liverpool","rating":3,"nation":"97","city"
:"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"Keel Wharf 31","description"
:"HOTEL: This hotel was built in 2008 air-conditioned and it has 310 large, comfortable rooms, with private
bathroom. Clients have available a lobby with a reception, a safe, a currency exchange, a lift, a bar
, a restaurant, conference facilities and a car park at an additional cost. \n\nSITUATION: This urban
hotel, is located close to the river. It is in Liverpool. It is in front of the new stadium and the
Congress Centre. It is located close to the historic dock Albert Docks. It is in the city centre. 200
metres from the establishment, you can find the train station Lime Street. It is 14 kilometres away
from John Lennon Airport. It is situated 60 kilometres away from Manchester Airport. 90 kilometres from
the establishment, guests will find Blackpool Airport. \n\nROOM: The rooms are large, bright and modern
. They have a bathroom, an air-conditioning system, internet, a radio, a television, a coffee maker,
a kettle, an individual air-conditioning system and individual heating. \n\nPAYMENT METHODS: Customers
can pay with credit cards, debit cards, American Express, Diners Club, Mastercard and Visa. \n\nOTHERS
: Regarding gastronomy, clients have English or continental breakfast and an \u00e0 la carte or set-menu
dinner. The establishment also offers meal service in the bar.","photo":"http:\/\/hoteles.veturis.com
\/photos\/40\/40472_1.jpg","latitudine":"53.3960730","longitudine":"-2.9879199","max_age_infant":"0"
,"max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"1.39","markup_agency"
:"15","type":"hotel"},{"id":"23014","provider_name":"veturis","provider":"veturis","session":"","name"
:"Radisson Blu Liverpool","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name"
:"","area_code":"","address":"OLD HALL STREET 107","description":"HOTEL: This urban is ideal for relaxing
hotel. Was opened in 2004, has 194 rooms, 9 floors, 189 double rooms and 5 suites. In the establishment
entrance guests are offered a large hall with an elevator, a reception with a safe deposit box, a currency
exchange and a cloakroom. Clients have available a caf\u00e9, a conference room, a cocktail bar, an
air-conditioned \u00e0 la carte restaurant and internet. Some of the services on offer are room service
and a laundry service. \n\nSITUATION: It is located in the city centre of Liverpool. It is in front
of the Mersey River. 500 metres away from the establishment, guests will find shops and leisure areas
. 100 metres away there is a public transport stop. It is situated 11.5 kilometres away from the airport
. \n\nROOM: The rooms comfortable, en-suite with hairdryer. They have a direct line telephone, satellite
TV, a radio, internet, a safe available at an additional cost, a minibar and a central heating system
. \n\nFACILITIES: Customers have at their disposal a covered pool, a gym, a sauna, a jacuzzi, a Turkish
bath, a massage service and a beauty treatment service. \n\nPAYMENT METHODS: The establishment accepts
American Express, Visa, Mastercard and Diners Club. \n\nOTHERS: Regarding gastronomy, clients have breakfast
in a buffet form and a set-menu lunch and dinner.","photo":"http:\/\/hoteles.veturis.com\/photos\/23
\/23014_2.jpg","latitudine":"53.4103012","longitudine":"-2.9960999","max_age_infant":"0","max_age_child"
:"12","status":"","currency":"EUR","order":"10000000","distance":"0.37","markup_agency":"15","type":"hotel"
},{"id":"68152","provider_name":"veturis","provider":"veturis","session":"","name":"Novotel Liverpool"
,"rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":""
,"address":"40 HANOVER STREET ","description":"HOTEL: This hoterestauranter, was opened in 2009, has
209 rooms, a designer, a bar and a car park with a security system. This air-conditioned conference
, hotel, has a reception, a safe, a currency exchange, a lift, conference facilities, internet, room
service and a laundry service. \n\nSITUATION: This urban hotel, is located in Paradise Street and Hanover
Street. It is in the centre of Liverpool. Close to the establishment clients can find Matthew Street
and Cavern club. It is close to the Lime Street Station. It is 2 minutes away from the Liverpool One
Shopping Centre, where you can find restaurants, bars and shops. It is 10 kilometres away from John
Lennon Airport. \n\nROOM: The rooms are modern and comfortable, have ensuite bathrooms with bath or
shower, a sofa-bed, a large workspace, an LCD television, films available at an additional cost, internet
, a hairdryer, an ironing set, computer safe, a minibar, a coffee maker, a kettle, an individual air-conditioning
system and a central heating system. \n\nFACILITIES: Guests have at their disposal a sauna, hydromassage
, tanning salon, a gym and a covered heated swimming pool. Some services for an additional fee. \n\nOTHERS
: Regarding gastronomy, the establishment offers a buffet breakfast. It has the Elements <with_breakfast_lunch_dinner_service
Id=\"N-2877451-2765654\">with A Breakfast, Lunch And Dinner Service<\/with_breakfast_lunch_dinner_service
> Restaurant. \n\nPAYMENT METHODS: Accepted payment methods are credit cards, American Express, Diners
Club, Mastercard, Visa and debit cards.","photo":"http:\/\/hoteles.veturis.com\/photos\/68\/68152_8
.jpg","latitudine":"53.4029200","longitudine":"-2.9844403","max_age_infant":"0","max_age_child":"12"
,"status":"","currency":"EUR","order":"10000000","distance":"0.77","markup_agency":"15","type":"hotel"
},{"id":"67575","provider_name":"veturis","provider":"veturis","session":"","name":"Hope Street Hotel"
,"rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":""
,"address":"40 HOPE STREET ","description":"HOTEL:\nBuilt around 1860 in the style of a Venetian palazo
- a fashionable look of the day. Reinvented and renovated in 2003 into 48 simple, stylish, contemporary
and comfortable rooms with a restaurant. Privately owned and independently run with an emphasis on friendliness
, good food and thoughtful service.\n\nSITUACI\u00d3N:\nSitting pretty between two magnificent cathedrals
, surrounded by two famous theatres, two legendary pubs, one treasured concert hall, and an abundance
and variety of restaurants. Further afield they are a five minute walk into town and a 20 min drive
to Liverpool John Lennon Airport.\n\nHABITACI\u00d3N:\n48 individually designed rooms, solid wood floors
warmed by under floor heating and king sized beds draped in Egyptian cotton. Rain dance showerheads
the size of dinner plates and Vola fittings complement timeless bathrooms that also include huge soft
towels, mist free mirrors and REN products. Wall mounted LCD wide screen TVs, DVD and CD players and
Arne Jacobsen telephones, along with complimentary broadband access in every room.\n\nCOMO LLEGAR:\nBy
Car: From Liverpool John Lennon Airport - Depart. At the roundabout, take the first exit. At the roundabout
, take the first exit onto Speke Hall Avenue. At the roundabout, take the second exit onto Speke Hall
Avenue. Turn left onto Speke Road A561. the roundabout, take the first exit onto Speke Road A561. Continue
onto A561. Turn left onto Dingle Lane A561. Turn right onto Park Road A561. Continue onto A561. Bear
right onto Great George Street A5038. Bear right onto Berry Street A5038. Turn right onto Leece Street
A5039. Continue onto A5039. Turn right onto Pilgrim Street. Turn left onto Back Hope Place. Arrive.
\n\nMETODOS DE PAGO:\nVisa, American Express, MasterCard, Maestro and cash are accepted as methods of
payment.\n\nOTRAS:\nThe London Carriage Works: modern international food, complemented by the use of
local, organic and fresh seasonal produce. One of Liverpools leading restaurants, enjoying rave reviews
and critical acclaim. It was voted one of the top ten restaurants outside London in the 2005 Hardens
Guide and achieved Liverpools highest score for cooking in The Good Food Guide 2006. Most recently it
won Taste of Englands Northwest 2008.","photo":"http:\/\/hoteles.veturis.com\/photos\/67\/67575_1.jpg"
,"latitudine":"53.4008340","longitudine":"-2.9710220","max_age_infant":"0","max_age_child":"12","status"
:"","currency":"EUR","order":"10000000","distance":"1.60","markup_agency":"15","type":"hotel"}],"room"
:[],"amenities":[]}
如果在firebug中我单击响应,但HTML json是:
{"hotel":[{"id":"17911","provider_name":"veturis","provider":"veturis","session":"","name":"Thistle Liverpool City Centre, Atlantic Tower","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"CHAPEL STREET ","description":"HOTEL: This hotel and was built in 1975. Was renovated in 1999, has 12 floors, 225 rooms, 217 double rooms and 2 suites. Clients have available a lobby with a reception and lifts. \n\nSITUATION: This urban hotel, is located in a main street. It is in a tourist area. 500 metres away, clients can find restaurants, bars and nightclubs. 1 kilometre away, there are shops. \n\nROOM: The comfortable, en-suite rooms. They have a hairdryer, a direct line telephone, satellite or cable television, a radio, a fridge, a minibar, fitted carpet, a safe-deposit box and a central heating system. \n\nMEALS: Regarding gastronomy, the establishment has a buffet breakfast and \u00e0 la carte or set-menu lunch and dinner. Dietary restrictions can be accomodated and special dishes made. \n\nPAYMENT METHODS: Accepted payment methods are American Express, Visa, Eurocard, Mastercard and Diners Club.","photo":"http:\/\/hoteles.veturis.com\/photos\/17\/17911_15.jpg","latitudine":"53.4076538","longitudine":"-2.9936891","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"0.16","markup_agency":"15","type":"hotel"},{"id":"20770","provider_name":"veturis","provider":"veturis","session":"","name":"Campanile Liverpool","rating":2,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"CHALONER STREET - QUEENS DOCK ","description":"HOTEL: This tourist hotel. Was built in 1990, has 100 rooms and 2 floors. Customers have available a reception, a cosy bar, a restaurant, a conference room, internet, a laundry service and a car park. \n\nSITUATION: It is situated near the historic harbour Albert Docks. This inviting hotel, is a few minutes walk from the city centre, where you can find shops, leisure areas, monuments and tourist points of interest. \n\nROOM: The rooms are cosy and they have an ensuite bathroom with hairdryer. They have a direct line telephone, a radio and a central heating system. \n\nPAYMENT METHODS: The establishment accepts American Express, Visa and Mastercard.","photo":"http:\/\/hoteles.veturis.com\/photos\/20\/20770_4.jpg","latitudine":"53.3949623","longitudine":"-2.9839790","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"1.57","markup_agency":"15","type":"hotel"},{"id":"21903","provider_name":"veturis","provider":"veturis","session":"","name":"Britannia Adelphi","rating":3,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"RANELAGH PLACE , L3 5UL","description":"HOTEL: Urban and was built in 1914. It has 6 floors, 402 rooms, 27 single rooms, 373 double rooms and 2 suites. In the establishment entrance guests are offered a lobby with elevators, a reception with a safe deposit box, a currency exchange, a car park and a garage. Customers have at their disposal a pub, a bar, a restaurant with highchairs and internet. Some services offered by the establishment are room service and a laundry service. \n\nSITUATION: This urban hotel, is situated in the city centre of Liverpool. 3 minutes away, guests can find the Lime Street Station. \n\nROOM: The rooms comfortable, en-suite with hairdryer. They have a direct line telephone, satellite or cable TV, a radio, internet, fitted carpet, a central heating system and a safe-deposit box. \n\nFACILITIES: Customers have at their disposal a swimming pool, a bar, parasols, a jacuzzi, a sauna, a solarium, a Turkish bath and a massage service. Clients can enjoy activities such as squash and do aerobics. The establishment also has a gym. \n\nPAYMENT METHODS: Accepted payment methods are American Express, Visa, Eurocard, Mastercard, Diners Club and EC. \n\nOTHERS: Regarding gastronomy, clients can enjoy all meals in buffet form, \u00e0 la carte or set-menu lunch and a set-menu dinner.","photo":"http:\/\/hoteles.veturis.com\/hotel-Britannia-Adelphi-F21903_1.jpg","latitudine":"53.4051056","longitudine":"-2.9796340","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"0.87","markup_agency":"15","type":"hotel"},{"id":"40472","provider_name":"veturis","provider":"veturis","session":"","name":"Jurys Inn Liverpool","rating":3,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"Keel Wharf 31","description":"HOTEL: This hotel was built in 2008 air-conditioned and it has 310 large, comfortable rooms, with private bathroom. Clients have available a lobby with a reception, a safe, a currency exchange, a lift, a bar, a restaurant, conference facilities and a car park at an additional cost. \n\nSITUATION: This urban hotel, is located close to the river. It is in Liverpool. It is in front of the new stadium and the Congress Centre. It is located close to the historic dock Albert Docks. It is in the city centre. 200 metres from the establishment, you can find the train station Lime Street. It is 14 kilometres away from John Lennon Airport. It is situated 60 kilometres away from Manchester Airport. 90 kilometres from the establishment, guests will find Blackpool Airport. \n\nROOM: The rooms are large, bright and modern. They have a bathroom, an air-conditioning system, internet, a radio, a television, a coffee maker, a kettle, an individual air-conditioning system and individual heating. \n\nPAYMENT METHODS: Customers can pay with credit cards, debit cards, American Express, Diners Club, Mastercard and Visa. \n\nOTHERS: Regarding gastronomy, clients have English or continental breakfast and an \u00e0 la carte or set-menu dinner. The establishment also offers meal service in the bar.","photo":"http:\/\/hoteles.veturis.com\/photos\/40\/40472_1.jpg","latitudine":"53.3960730","longitudine":"-2.9879199","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"1.39","markup_agency":"15","type":"hotel"},{"id":"23014","provider_name":"veturis","provider":"veturis","session":"","name":"Radisson Blu Liverpool","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"OLD HALL STREET 107","description":"HOTEL: This urban is ideal for relaxing hotel. Was opened in 2004, has 194 rooms, 9 floors, 189 double rooms and 5 suites. In the establishment entrance guests are offered a large hall with an elevator, a reception with a safe deposit box, a currency exchange and a cloakroom. Clients have available a caf\u00e9, a conference room, a cocktail bar, an air-conditioned \u00e0 la carte restaurant and internet. Some of the services on offer are room service and a laundry service. \n\nSITUATION: It is located in the city centre of Liverpool. It is in front of the Mersey River. 500 metres away from the establishment, guests will find shops and leisure areas. 100 metres away there is a public transport stop. It is situated 11.5 kilometres away from the airport. \n\nROOM: The rooms comfortable, en-suite with hairdryer. They have a direct line telephone, satellite TV, a radio, internet, a safe available at an additional cost, a minibar and a central heating system. \n\nFACILITIES: Customers have at their disposal a covered pool, a gym, a sauna, a jacuzzi, a Turkish bath, a massage service and a beauty treatment service. \n\nPAYMENT METHODS: The establishment accepts American Express, Visa, Mastercard and Diners Club. \n\nOTHERS: Regarding gastronomy, clients have breakfast in a buffet form and a set-menu lunch and dinner.","photo":"http:\/\/hoteles.veturis.com\/photos\/23\/23014_2.jpg","latitudine":"53.4103012","longitudine":"-2.9960999","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"0.37","markup_agency":"15","type":"hotel"},{"id":"68152","provider_name":"veturis","provider":"veturis","session":"","name":"Novotel Liverpool","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"40 HANOVER STREET ","description":"HOTEL: This hoterestauranter, was opened in 2009, has 209 rooms, a designer, a bar and a car park with a security system. This air-conditioned conference, hotel, has a reception, a safe, a currency exchange, a lift, conference facilities, internet, room service and a laundry service. \n\nSITUATION: This urban hotel, is located in Paradise Street and Hanover Street. It is in the centre of Liverpool. Close to the establishment clients can find Matthew Street and Cavern club. It is close to the Lime Street Station. It is 2 minutes away from the Liverpool One Shopping Centre, where you can find restaurants, bars and shops. It is 10 kilometres away from John Lennon Airport. \n\nROOM: The rooms are modern and comfortable, have ensuite bathrooms with bath or shower, a sofa-bed, a large workspace, an LCD television, films available at an additional cost, internet, a hairdryer, an ironing set, computer safe, a minibar, a coffee maker, a kettle, an individual air-conditioning system and a central heating system. \n\nFACILITIES: Guests have at their disposal a sauna, hydromassage, tanning salon, a gym and a covered heated swimming pool. Some services for an additional fee. \n\nOTHERS: Regarding gastronomy, the establishment offers a buffet breakfast. It has the Elements with A Breakfast, Lunch And Dinner Service<\/with_breakfast_lunch_dinner_service> Restaurant. \n\nPAYMENT METHODS: Accepted payment methods are credit cards, American Express, Diners Club, Mastercard, Visa and debit cards.","photo":"http:\/\/hoteles.veturis.com\/photos\/68\/68152_8.jpg","latitudine":"53.4029200","longitudine":"-2.9844403","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"0.77","markup_agency":"15","type":"hotel"},{"id":"67575","provider_name":"veturis","provider":"veturis","session":"","name":"Hope Street Hotel","rating":4,"nation":"97","city":"394","nation_name":"","city_name":"","area_name":"","area_code":"","address":"40 HOPE STREET ","description":"HOTEL:\nBuilt around 1860 in the style of a Venetian palazo - a fashionable look of the day. Reinvented and renovated in 2003 into 48 simple, stylish, contemporary and comfortable rooms with a restaurant. Privately owned and independently run with an emphasis on friendliness, good food and thoughtful service.\n\nSITUACI\u00d3N:\nSitting pretty between two magnificent cathedrals, surrounded by two famous theatres, two legendary pubs, one treasured concert hall, and an abundance and variety of restaurants. Further afield they are a five minute walk into town and a 20 min drive to Liverpool John Lennon Airport.\n\nHABITACI\u00d3N:\n48 individually designed rooms, solid wood floors warmed by under floor heating and king sized beds draped in Egyptian cotton. Rain dance showerheads the size of dinner plates and Vola fittings complement timeless bathrooms that also include huge soft towels, mist free mirrors and REN products. Wall mounted LCD wide screen TVs, DVD and CD players and Arne Jacobsen telephones, along with complimentary broadband access in every room.\n\nCOMO LLEGAR:\nBy Car: From Liverpool John Lennon Airport - Depart. At the roundabout, take the first exit. At the roundabout, take the first exit onto Speke Hall Avenue. At the roundabout, take the second exit onto Speke Hall Avenue. Turn left onto Speke Road A561. the roundabout, take the first exit onto Speke Road A561. Continue onto A561. Turn left onto Dingle Lane A561. Turn right onto Park Road A561. Continue onto A561. Bear right onto Great George Street A5038. Bear right onto Berry Street A5038. Turn right onto Leece Street A5039. Continue onto A5039. Turn right onto Pilgrim Street. Turn left onto Back Hope Place. Arrive.\n\nMETODOS DE PAGO:\nVisa, American Express, MasterCard, Maestro and cash are accepted as methods of payment.\n\nOTRAS:\nThe London Carriage Works: modern international food, complemented by the use of local, organic and fresh seasonal produce. One of Liverpools leading restaurants, enjoying rave reviews and critical acclaim. It was voted one of the top ten restaurants outside London in the 2005 Hardens Guide and achieved Liverpools highest score for cooking in The Good Food Guide 2006. Most recently it won Taste of Englands Northwest 2008.","photo":"http:\/\/hoteles.veturis.com\/photos\/67\/67575_1.jpg","latitudine":"53.4008340","longitudine":"-2.9710220","max_age_infant":"0","max_age_child":"12","status":"","currency":"EUR","order":"10000000","distance":"1.60","markup_agency":"15","type":"hotel"}],"room":[],"amenities":[]}
好的,在javascript中我必须成功回调:
var data_hotel = data.hotel;
var string_hotel = JSON.stringify(data_hotel)
在stringify行返回此错误:
SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 1 column 9574 of the JSON data
但是如果我以这种方式从firebug选项卡HTML(而不是响应选项卡)复制响应:
var data_response = '{"hotel":[{"id":"17911","provider_name":"ve....}]} '; // I can't copy because is too long for a stackoverflow question
var data_hotel = data_response.hotel;
var string_hotel = JSON.stringify(data_hotel)
这样可以正常工作并且不会返回错误。 为什么?
答案 0 :(得分:1)
如果我错了,请纠正我但似乎在你打电话时
var data_hotel = data_response.hotel;
您已经指向酒店元素,这意味着您应该进行字符串化
var string_hotel = JSON.stringify(data_hotel)
而不是
var string_hotel = JSON.stringify(data_hotel.hotel)