powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / JSON и Javascript
9 сообщений из 9, страница 1 из 1
JSON и Javascript
    #38284465
ccoder
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Застрял казалось бы на такой ерунде
Есть JSON по адресу http://www.streethub.com/api/challenge
нужно получить его, пройти весь список data и вывести именна с postcod'ами.

Перепробовал что нашел но так и ненашел рабочее решение
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284477
Фотография Яростный Меч
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
а как пробовал?
если это чужой сайт, то аяксом получить нельзя.
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284479
ccoder
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Мне просто нужно расспарсить и пройти тот массив который там. т.е. вытянуть именна с postcod'ами.
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284516
Фотография Малыхин Сергей
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Что бы что то расcпарсить нужно с начало это получить

в топике нет информации как ты пытаешься получить этот JSON

Скорее всего ты пытаешься c HTML страницы использовать что то вроде
Код: html
1.
 $.getJSON("http://www.streethub.com/api/challenge",function (data){;});

на чужой домен а чужой домен не дает разрешения в HTTP заголовках на использование этого JSON на других доменах
т.е. на HTML странице нельзя получить этот JSON AJAX запросом
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284527
Фотография Antonariy
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Ну что вы привязались, парню же надо просто распарсить :)
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284549
IDVsbruck
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Типа такого ? Просто непонятно, что ты собираешься с ним делать? И это разово или на постоянной основе?
Правильней всего было бы использовать серверные технологии: по адресу получить данные (текстовые), JSON-парсером их распарсить, вытащить что надо и отдать клиенту.
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284555
ccoder
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Ну какбы надо взять этот текст, расспарсить(т.е. получить структуру данных ввиду javascript объекта), пройти и получить то что нужно.
Както вроде как и есть, а как сделать надо то неработает то что я находил готовое
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284572
Фотография Яростный Меч
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ccoder,

Мы до сих пор не понимаем, что значит "взять этот текст".
В самом простом случае - просто открыть ссылку в браузере и скопировать текст в буфер обмена. Потом создать js файл, в нем написать "var myObj = " и вставить текст из буфера. В итоге у тебя готовый объект.
...
Рейтинг: 0 / 0
JSON и Javascript
    #38284697
ShSerge
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ccoder,

Snowden Flood SE19PH
Locomocean SE19PH
j-me original design SE19PH
Whitbread and Wilkinson SE19PH
Homage N160LA
MAIDEN E16HU
Archipelago Textiles SE19PH
Ganesha SE19PP
Black+Blum SE19PH
Live with Me E27RG
Start Space E27RG
B Southgate E27RH
Of Cabbages and Kings N160PH
East London Furniture N160LH
Rouge N167JL
Thornback and Peel WC1N3QT
Copperleafprint E84QB
Bodo Sperlein SE19PH

Если это оно - то вот код:

Код: html
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
<html>
<body>
</body>
<script>
var json={"meta":{"took":49,"type":"store","total":18},"response":{"data":[{"id":"513e43396fa76dc974000009","name":"Snowden Flood","slug":"snowden-flood","description":"Snowden Flood is an interior accessories designer based in a studio/shop on the River Thames in London's Oxo Tower Wharf. She studied Fine Art and then did a masters in sculpture in NY. She is inspired by many different things but is particularly keen on souvenirs and keepsakes.  Her work is stocked by many of the worlds best stores including Liberty and Fortnum & Masons in London, Lane Crawford in Hong Kong and Mitsukoshi in Tokyo.  She frequently undertakes commissions - clients include Tate Modern, British Museum, Chatsworth House, London Transport Museum.  Wherever possible she manufactures her collections in the UK.","images":["https://www.filepicker.io/api/file/38lqlQrcSmyN0mBzayqG","https://www.filepicker.io/api/file/duo90quFT7i651cyDAMV"],"postcode":"SE19PH","address":"1.01 First Floor Courtyard, Oxo Tower Wharf, Bargehouse Street","oh":"Mon-Fri 10am - 6pm / Sat: 11am - 6pm / Sun: 12 - 5pm","supportEmail":"info@snowdenflood.com","supportNumber":"+44 (0)20 7401 8710","createdAt":"Mon Mar 11 2013 20:48:57 GMT+0000 (UTC)","updatedAt":"Thu May 30 2013 11:01:31 GMT+0000 (UTC)","links":{"products":[]}},{"id":"5143225630bb56be54000008","name":"Locomocean","slug":"locomocean-ltd","description":"Welcome!\r\n\r\nLocomocean means a mad (crazy) movement. We are a design and manufacturing company with a focus to offer fun designs that bring a smile to your face and enjoyment to your life.\r\n\r\n\r\nWe have vast experience in developing innovative products, lighting, gift and souvenirs ware for our clients. We have developed concepts into finished products, developed fun quirky giftware ideas for multiple retailers.\r\n\r\n\r\nOur products are sold worldwide in store and online. But you can also visit us in person at our shop in the Oxo Tower, London.\r\n\r\nLocated on the second floor, riverside shopping area.\r\n","images":["https://www.filepicker.io/api/file/CrNZwjBnQrWu1wPRNNjp","https://www.filepicker.io/api/file/GAVmqSnLS1KWLVSOKhUA","https://www.filepicker.io/api/file/teukonefR4e1MuqvH5tR"],"postcode":"SE19PH","address":"Unit 1.02, Oxo Tower Wharf","oh":"Mon: Closed / Tue - Sat: 10:00am - 6:00pm / Sun: Closed","supportEmail":"barty@locomocean.com","supportNumber":"020 7928 4921","createdAt":"Fri Mar 15 2013 13:29:58 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:38:13 GMT+0000 (UTC)","links":{"products":[]}},{"id":"514ae53031fd34171b000002","name":"j-me original design","slug":"j-me-original-design-ltd","description":"j-me was founded in 2000 with the desire to create products for the design conscious. Winning awards along the way and successfully exporting the j-me brand globally, j-me has worked hard to earn a reputation for consistently producing high-quality products that show a love of design, attention to detail and a sense of humour. Located in the creative hub of London's Oxo Tower, brothers Jamie and Mark follow a focused design ethos which results in a range of products that encompass original, intelligent design and everyday function.","images":["https://www.filepicker.io/api/file/kQ02eCzkTpmHPJb6Ws4Z"],"postcode":"SE19PH","address":"Unit 1.20 - 1.21 Oxo Tower Wharf, Bargehouse Street","oh":"Mon-Fri: 9am - 6pm / Sat: 11am - 6pm / Sun: Closed","supportEmail":"Info@j-me.co.uk","supportNumber":"0207 928 8828","createdAt":"Thu Mar 21 2013 10:47:12 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:38:48 GMT+0000 (UTC)","links":{"products":[]}},{"id":"514c33f631fd34171b000032","name":"Whitbread and Wilkinson","slug":"whitbread-and-wilkinson","description":"Whitbread Wilkinson was launched in 2000, initially comprising of Jackie and Victoria, a creative partnership dedicated to innovative design and solutions.\r\n\r\nFast-forward 12 years and they are now a busy studio of 10 involved in a wide array of interesting projects.\r\n\r\nBesides building their own brand,  Jackie, Victoria and their team work on design commissions for businesses large and small - ranging from Bathstore, Sainsbury's, London Underground and English Heritage to smaller boutique companies. \r\n\r\nMost recent successes include their licenses with Eames and PANTONE UNIVERSE™, adding The National Gallery in 2011 where they have created an exciting range of high-end giftware that sells worldwide.","images":["https://www.filepicker.io/api/file/Mhh3CrXKS4S836FkgYvW"],"postcode":"SE19PH","address":"2.01/2.02 Oxo Tower Wharf, Bargehouse Street","oh":"Mon - Fri: 10am - 6pm","supportEmail":"sales@w2products.com","supportNumber":"0207 922 1444","createdAt":"Fri Mar 22 2013 10:35:34 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:38:34 GMT+0000 (UTC)","links":{"products":[]}},{"id":"514dde5831fd34171b00003a","name":"Homage","slug":"homage","description":"Homage is an independent home interiors shop situated in the heart of Stoke Newington Church Street. \r\n\r\nWe passionately focus on quality and unique design. Selecting from a wide range of designers, we bring together hand made reclaimed wood furniture from Asia with Scandinavian interiors from Denmark. Vintage finds and original designs are coupled with Dutch modern contemporary pieces. \r\n\r\nWe hope you enjoy the Homage range as much as we do.  \r\n\r\nMark & Liza","images":["https://www.filepicker.io/api/file/7pm89bqSmu0UiVkvr41A"],"postcode":"N160LA","address":"106 Stoke Newington Church Street","oh":"Mon: Closed / Tue - Sat: 11am - 6pm / Sun: 12pm - 5pm","supportEmail":"shop@homageonline.co.uk","supportNumber":"0203 556 8362","createdAt":"Sat Mar 23 2013 16:54:48 GMT+0000 (UTC)","updatedAt":"Thu May 02 2013 12:27:04 GMT+0000 (UTC)","links":{"products":[]}},{"id":"515344e831fd34171b00007b","name":"MAIDEN","slug":"maiden","description":"MAIDEN is simply a really great shop with a mission to sell amazing products to amazing people like YOU! \r\n\r\nMAIDEN sells a wonderfully fun collection of homeware and gifts with a humourous twist. \r\n\r\nWhether you're after a giant Miffy lamp or a cat scratching post shaped like a record deck. Maiden is your one stop shop for products which are fun, well designed and downright fabulous! ","images":["https://www.filepicker.io/api/file/sAYhfNgSsKKao3uXt0ZE","https://www.filepicker.io/api/file/NHhqEGzMRxCsY3sY3lDm"],"postcode":"E16HU","address":"MAIDEN, 188 Shoreditch High Street","oh":"Mo-Fri: 11-7:30pm / Sat: 11-6pm / Sun: 12-6pm ","supportEmail":"info@maidenshop.com","supportNumber":"0207 998 0185","createdAt":"Wed Mar 27 2013 19:13:44 GMT+0000 (UTC)","updatedAt":"Sun May 26 2013 14:54:23 GMT+0000 (UTC)","links":{"products":[]}},{"id":"5154cc2731fd34171b00009d","name":"Archipelago Textiles","slug":"archipelago-textiles","description":"Doreen designs and produces seductive hand-woven textiles that can be used to enhance a home or work environment. A rare skill with less than 200 hand-weavers in the UK.\r\n\r\nHer luxurious throws, bed covers and hangings are produced using the finest natural yarns of cotton, linen and silk. Doreen can also weave silks into a light gossamer fabric for scarves and bridal shawls as well as interior fabrics.","images":["https://www.filepicker.io/api/file/OjsFr2voQzGmAYNlVFRg"],"postcode":"SE19PH","address":"1.07, first floor riverside, Oxo Tower Wharf, Bargehouse Street","oh":"Mon: closed / Tue-Sat: 11am - 6pm / Sun: by appointment only","supportEmail":"info@archipelagotextiles.co.uk","supportNumber":"020 7922 1121","createdAt":"Thu Mar 28 2013 23:03:03 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:37:47 GMT+0000 (UTC)","links":{"products":[]}},{"id":"515c09a702b9b22d1f000003","name":"Ganesha","slug":"ganesha","description":"Ganesha is a fair trade partnership formed by Jo Lawbuary and Purnendu Roy, with a shop on London's South Bank. We import quality home furnishings and accessories from India, sourced from / developed with co-operatives and producer associations. Extending markets for marginal(ised) producers and supplying the UK with life-enhancing goods, we are supporting an alternative vision of trade. Happy shopping!","images":["https://www.filepicker.io/api/file/hkuEN6OASM2Gt6hH3P9M"],"postcode":"SE19PP","address":"3 + 4 Gabriel's Wharf, 56 Upper Ground, South Bank","oh":"Mon-Sun: 11:30am - 7:00pm","supportEmail":"mail@ganesha.co.uk","supportNumber":"020 7928 3444","createdAt":"Wed Apr 03 2013 10:51:19 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:37:34 GMT+0000 (UTC)","links":{"products":[]}},{"id":"515d8c16c96f28000000002a","name":"Black+Blum","slug":"black+blum","description":"We are an Anglo-Swiss partnership who joined forces in 1998 and based ourselves in London, the European heart of design. As a design consultancy we advise companies on any creative aspect. This accumulating insight into different markets catalysed the decision to develop our own range of products. It has since become a vehicle to fully explore and enjoy our creativity.\r\n\r\nOur designs have won numerous awards and are sold through selected stores all over the world.\r\n\r\nWe are driven by the opportunity to give each design their own unique character and soul. Our brief is to create functional products that will charm and entertain. We are passionate about design and realise that a true black+blum product is always a joint input of Dan and Martin's personalities.\r\n\r\nHopefully you will get as much enjoyment from black+blum products as we got from designing them.","images":["https://www.filepicker.io/api/file/29LouwAQdqfrhIvrLRig"],"postcode":"SE19PH","address":"2.07 Oxo Tower Wharf, Bargehouse Street","oh":"Mo-Fr: 9am to 5:30pm","supportEmail":"gwladys@black-blum.com","supportNumber":"020 7633 0022","createdAt":"Thu Apr 04 2013 14:20:06 GMT+0000 (UTC)","updatedAt":"Mon Apr 22 2013 16:08:57 GMT+0000 (UTC)","links":{"products":[]}},{"id":"5165664032e55b0e35000002","name":"Live with Me","slug":"live-with-me","description":"Live with Me is a shop at Top Floor 144 Columbia Road in East London, selling designer-made homeware, art, modern craft, stationery, ceramics, jewellery and a variety of other curious items.\r\n\r\nLive with Me is owned and curated by me, Claire Henry.\r\n\r\nHaving studied archaeology and museums at university, I have spent the last ten years living in London, working as an exhibitions curator in a variety of museums, galleries and historic houses. Live with me was born of my passion for curation and my obsession with objects. I wanted to make a place that supported up and coming designer-makers by selling a collection of handmade objects. Both useful and beautiful. ","images":["https://www.filepicker.io/api/file/DT9kCsXmQ8OVRK6RTW5d"],"postcode":"E27RG","address":"Top Floor, 144 Columbia Road London","oh":"Sat: 12-5 / Sun: 10-5, or by appointment","supportEmail":"claire@livewithme.co.uk","supportNumber":"0758 11 55 228","createdAt":"Wed Apr 10 2013 13:16:48 GMT+0000 (UTC)","updatedAt":"Sun May 26 2013 14:54:10 GMT+0000 (UTC)","links":{"products":[]}},{"id":"516c0474d301240000000002","name":"Start Space","slug":"start-space","description":"We aim to present up and coming artists in all mediums, while concentration on images of London and naive art. Our gallery also has mid century Danish and English furniture as well as modern design.","images":["https://www.filepicker.io/api/file/T3VohMuiSa2RrUAejWPr"],"postcode":"E27RG","address":"150 Columbia Road","oh":"Sat: 12-6; Sun: 8-4; all other times by appointment","supportEmail":"gary@startspace.co.uk","supportNumber":"02077290049","createdAt":"Mon Apr 15 2013 13:45:24 GMT+0000 (UTC)","updatedAt":"Sun May 26 2013 14:54:36 GMT+0000 (UTC)","links":{"products":[]}},{"id":"516d776d3d5d5d0000000006","name":"B Southgate","slug":"b-southgate","description":"Furniture dealer Ben Southgate sells a wide range of antique and vintage furniture from his shop at the Columbia Road Flower Market in London's East End. He specialises in handsome storage and display pieces, leather sofas and armchairs, as well as an eclectic array of lighting, toys, and collectibles.\r\n\r\nThe stock at B Southgate varies tremendously from week to week. There is always new stock and pieces rarely stick around, so check back often!","images":["https://www.filepicker.io/api/file/N2QfVQaXSgWzooimCSm3"],"postcode":"E27RH","address":"B Southgate, 4 The Courtyard, Ezra Street","oh":"Sundays: 9am-3pm","supportEmail":"ben@bsouthgate.co.uk","supportNumber":"07905 960792","createdAt":"Tue Apr 16 2013 16:08:13 GMT+0000 (UTC)","updatedAt":"Tue Apr 30 2013 20:29:02 GMT+0000 (UTC)","links":{"products":[]}},{"id":"516fdbd33d5d5d0000000017","name":"Of Cabbages and Kings","slug":"of-cabbages-and-kings","description":"All Of Cabbages and Kings products are made in the UK by British based designers and makers. The store houses an eclectic range of contemporary fine art prints by local illustrators, mostly in limited edition, and the space is as much an art and crafts gallery as it is a gift shop. \r\n\r\nIn October 2012 Of Cabbages and Kings took up new residence at 127 Stoke Newington High Street, also the home of Knit with attitude, specialists in eco-friendly and fairtrade yarn.","images":["https://www.filepicker.io/api/file/09UF3JMTRuruN78fSjyg","https://www.filepicker.io/api/file/0whfywtUQ6eibsTdQ92q","https://www.filepicker.io/api/file/iNXQ4gGRRgKPyUguZV3W"],"postcode":"N160PH","address":"127 Stoke Newington High Street","oh":"Mon - Tues 10am - 5pm / Weds - Sat 10am - 6pm / Sun 12 pm - 6pm","supportEmail":"shop@ofcabbagesandkings.co.uk","supportNumber":"020 7998 3282","createdAt":"Thu Apr 18 2013 11:41:07 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:43:07 GMT+0000 (UTC)","links":{"products":[]}},{"id":"517025813d5d5d000000002d","name":"East London Furniture","slug":"east-london-furniture","description":"East London Furniture make furniture from 100% recycled materials. \r\n\r\nAll products are made in our central London workshop. \r\n\r\nGoing beyond the normal reclaimed timber yards, all materials used are salvaged from waste, meaning that most materials used in the products have been diverted from landfill. \r\n\r\nEast London Furniture is supported by Crisis.","images":["https://www.filepicker.io/api/file/3REU8P8PQ7WZHWUfMo5t"],"postcode":"N160LH","address":"197-199 Stoke Newington High St","oh":"Mon: Closed / Tue - Sun: 10:00am - 6:00pm","supportEmail":"info@eastlondonfurniture.co.uk","supportNumber":"07709 429 687","createdAt":"Thu Apr 18 2013 16:55:29 GMT+0000 (UTC)","updatedAt":"Fri Apr 19 2013 15:42:58 GMT+0000 (UTC)","links":{"products":[]}},{"id":"518b45238340a50000000011","name":"Rouge","slug":"rouge","description":"Rouge specialises in vintage and new furniture, ceramics and decorative items for the home, mostly sourced directly from China. The bold colours and simple forms provide splashes of colour and texture that complement a contemporary home. Rouge is situated in the heart of independent shops, bars and restaurants of Stoke Newington, an area offering an alternative to the chain-bland, clone high street experience of much of London.","images":["https://www.filepicker.io/api/file/LRCg3XhSBKhDv9oPowvA"],"postcode":"N167JL","address":"158 Stoke Newington High Street","oh":"Mon-Sat 11:00am to 6:30pm (closed Tues) Sun 12noon to 5pm","supportEmail":"lei@rouge-shop.co.uk","supportNumber":"020 7275 0887","createdAt":"Thu May 09 2013 06:41:39 GMT+0000 (UTC)","updatedAt":"Fri May 17 2013 08:50:46 GMT+0000 (UTC)","links":{"products":[]}},{"id":"519c9b807725660000000002","name":"Thornback and Peel","slug":"thornback-and-peel","description":"Juliet Thornback and Delia Peel met in 2003. While retaining their day jobs as a florist (Thornback) and theatre designer (Peel), they embarked upon their first collaboration, a series of handprinted clutch bags. They set up a studio in 2006 at Cockpit Arts, London. A year later they established Thornback & Peel to create beautiful, intricate screen-printed pieces for the home.\r\n\r\nThey soon emerged with their signature style. Borrowing imagery that plays on artistic traditions, they combined modernist geometric patterns with 19th century wood engravings. Their work is inspired by an eclectic mixture of Victoriana, Mrs Beeton’s household management, Mr McGregor’s garden, 17th century microscope imagery of the natural world, Norfolk and Devon. Thornback & Peel is a celebration of the quirkiness of British humour and design.","images":["https://www.filepicker.io/api/file/f6aef9vJRuW69KJIDI9J"],"postcode":"WC1N3QT","address":"Thornback and Peel, 7 Rugby Street, London ","oh":"Monday-Saturday 10-6","supportEmail":"info@thornbackandpeel.co.uk","supportNumber":"(0)207 831 2878","createdAt":"Wed May 22 2013 10:18:40 GMT+0000 (UTC)","updatedAt":"Thu May 23 2013 20:35:37 GMT+0000 (UTC)","links":{"products":[]}},{"id":"51a607469e8e110000000010","name":"Copperleafprint","slug":"copperleafprint","description":"Original hand made etchings, screenprint, linocut and canvas prints","images":["https://www.filepicker.io/api/file/Q3PUPw7nTKGcoCSPbFcg"],"postcode":"E84QB","address":"Broadway Market or Studio by appointment","oh":"Saturday 10 - 16:30 ","supportEmail":"info@copperleafprint.com","supportNumber":"07931905618","createdAt":"Wed May 29 2013 13:48:54 GMT+0000 (UTC)","updatedAt":"Mon Jun 03 2013 15:05:27 GMT+0000 (UTC)","links":{"products":[]}},{"id":"51928ca9278a600000000002","name":"Bodo Sperlein","slug":"bodo-sperlein","description":"Bodo Sperlein ltd is a London based product design consultancy. Our approach is unique as we not only design collections but also provide art direction & create marketing strategies for a wide variety of global clients in house. We reinvigorate brands, uncovering their history and craft, giving them the attention they deserve.","images":["https://www.filepicker.io/api/file/FyiwcJRRR8awmfkQortm"],"postcode":"SE19PH","address":"Unit 2.05 Oxo Tower Wharf, Barge House Street","oh":"Mo-Fri: 10am-6pm. Sat-Sun: Closed","supportEmail":"info@bodosperlein.com","supportNumber":"0207 6339413","createdAt":"Tue May 14 2013 19:12:41 GMT+0000 (UTC)","updatedAt":"Sun May 26 2013 14:56:23 GMT+0000 (UTC)","links":{"products":[]}}]}};
var dt=json.response.data;
for (var i=0;i<dt.length;i++){
document.body.innerHTML+=dt[i].name+' '+dt[i].postcode+'< br />';
}
</script>
</html>


...
Рейтинг: 0 / 0
9 сообщений из 9, страница 1 из 1
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / JSON и Javascript
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]