JavaScript Javascript - How to parse json in graph api facebook from http get? javascript parse json string,javascript parse json array,javascript parse

I'm using graph api to search the group, here is http request:

var url ="https://graph.facebook.com/search?type=group&q=house&access_token=access_token&callback=FB.__globalCallbacks.f317bdb78&limit=5&method=get&pretty=0&sdk=joey".

$.get(url, function( resp ) {
   console.log(resp);//it's return resp
   var obj = jQuery.parseJSON(resp.data);//I got error here, resp.data is undefined
   console.log(obj);
});

Here it's response from graph API:

/**/ FB.__globalCallbacks.f317bdb78({"data":[{"name":"House Party !!!","privacy":"CLOSED","id":"881671771927203"},{"name":"KITTY'S HOUSE","privacy":"OPEN","id":"100126236854592"},{"name":"Full House Long Xuy\u00ean","privacy":"OPEN","id":"606749376035865"},{"name":"Housing Ho Chi Minh City (Saigon)","privacy":"CLOSED","id":"330339417123482"},{"name":"Ch\u0103n Drap House","privacy":"OPEN","id":"1397025403874006"}],"paging":{"cursors":{"before":"MAZDZD","after":"NAZDZD"},"next":"https:\/\/graph.facebook.com\/v2.0\/search?access_token=access_token&pretty=0&q=house&type=group&limit=5&after=NAZDZD"}});

How can I parse JSON data from response graph search facebook?

Answer:1

If you are using JSONP (note callback=? GET parameter) then your code should be:

var url ="https://graph.facebook.com/search?type=group&q=house&access_token=access_token&callback=?&limit=5&method=get&pretty=0&sdk=joey";

$.getJSON(url, function( resp ) {
   console.log(resp);
});

or more generic:

var url ="https://graph.facebook.com/search?type=group&q=house&access_token=access_token&callback=?&limit=5&method=get&pretty=0&sdk=joey";

$.ajax({
   url: url,
   dataType: 'jsonp'
}).then(function(resp) {
   console.log(resp);
})
Answer:2

I can't seem to get the owl carousel onchange function to fire off. Here's a snippet of the relevant code, any ideas? HTML: <div id="my-carousel" class="owl-carousel owl-theme"> <div ...

I can't seem to get the owl carousel onchange function to fire off. Here's a snippet of the relevant code, any ideas? HTML: <div id="my-carousel" class="owl-carousel owl-theme"> <div ...

<ul class=""> <li><img src="" alt=""/></li> <li><img src="" alt=""/></li> <li><img src="" alt=""/></li> <li><img ...

<ul class=""> <li><img src="" alt=""/></li> <li><img src="" alt=""/></li> <li><img src="" alt=""/></li> <li><img ...

  1. javascript images from folder
  2. javascript images in array
  3. javascript load images from folder
  4. javascript get images from folder
  5. javascript read images from folder
  6. javascript download images from url
  7. javascript display images from folder
  8. javascript show images from directory
  9. javascript download images from website
  10. javascript load images from directory
  11. javascript display images from an array
  12. javascript add images from folder
  13. javascript show images from folder
  14. javascript extract images from pdf
  15. javascript fetch images from folder
  16. javascript get images from url
  17. javascript get images from directory
  18. javascript read images from directory
  19. javascript pull images from folder
  20. javascript stop images from loading

Running into a problem with the scrollmagic 'section wipes (natural)' activation. What I have in my wordpress theme: functions.php wp_enqueue_script( 'tweenmax' ); wp_enqueue_script( 'scrollMagic' );...

Running into a problem with the scrollmagic 'section wipes (natural)' activation. What I have in my wordpress theme: functions.php wp_enqueue_script( 'tweenmax' ); wp_enqueue_script( 'scrollMagic' );...

  1. canvas
  2. canada
  3. cancelled
  4. canceled vs cancelled
  5. cancun
  6. canada goose
  7. cane corso
  8. canes
  9. canadian prime minister
  10. cancun flights
  11. canker sore
  12. candy
  13. cancer
  14. canon
  15. canvas prints
  16. cancer sign
  17. candace owens
  18. canada news
  19. candytopia
  20. canlis

I just started to learn Angular ES6 way. I am analyzing this example from github: https://github.com/sitepoint-editors/Angular-ES6-BookShelf/blob/master/app/Controllers/HomeController.js And I tried ...

I just started to learn Angular ES6 way. I am analyzing this example from github: https://github.com/sitepoint-editors/Angular-ES6-BookShelf/blob/master/app/Controllers/HomeController.js And I tried ...

  1. angular inject function
  2. angular inject function into component
  3. angularjs inject function
  4. angularjs inject function into controller
  5. angular inject into function
  6. angular 2 inject function
  7. angular testing inject function
  8. angular 7 inject function
  9. angular dependency injection function
  10. angularjs inject into function
  11. angular inject service into function
  12. angular inject service in function
  13. angular export function inject service
  14. angular inject dependency into function
  15. angular injector dependency function