I have this link
I need to take names from this source, text and display on the page
I have no idea how to rip text from a third-party source. I will be grateful
I have this link
I need to take names from this source, text and display on the page
I have no idea how to rip text from a third-party source. I will be grateful
We use ajax with jsonp type.
When receiving data, we process the received json object as we like. In this case, simply display the text in a div using the callback function.
var url = 'https://api.vk.com/method/wall.getComments?owner_id=-30458160&post_id=24905&v=5.58'; $.ajax({ url: url, dataType: "jsonp", success: function( response ) { if (response && response.response.count > 0) { //console.log( response ); response.response.items.forEach(function(item, i, arr) { $('#response-text').append(item.text + '<br/><br/>'); }); } } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="response-text"></div> var url = 'https://api.vk.com/method/wall.getComments?owner_id=-30458160&post_id=24905&v=5.58'; $.ajax({ url: url, dataType: "jsonp", success: callback }); function callback(response) { if (response && response.response.count > 0) { //console.log( response ); response.response.items.forEach(function(item, i, arr) { $('#response-text').append(item.text + '<br/><br/>'); }); } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="response-text"></div> And it is advisable to separate the url and the data that is passed to it when prompted. Those. the data will be in the data block Ajax request. Something like:
... url: 'https://api.vk.com/method/wall.getComments', data: { 'owner_id': '-30458160', 'post_id': '24905', 'v': '5.58' }, ... Source: https://ru.stackoverflow.com/questions/605372/
All Articles