Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Kevin
@KevinBruland
sorry, I think I am a bit confused by the layout
grantknaver
@grantknaver
lol its fine
Kevin
@KevinBruland
so your get offline is supposed to be a seperate API call, right?
grantknaver
@grantknaver
yes
I was going to use two diffent api calls to get the info I need
if you have a different idea on how I can generate the info for the different channels, I am open to suggestions
Kevin
@KevinBruland
where are you calling getOffline?
grantknaver
@grantknaver
I took it off. it was at the very bottom
it generates a very weird result
I figured the weird result was because I was not inferring what indexes of channels to apply getOffline to
Kevin
@KevinBruland
I am still looking, I am not really sure if I can help with this format, ive done them very differently
grantknaver
@grantknaver
what did you do
am I completely off the mark
Kevin
@KevinBruland
I don't think you are, but I wouldnt do a seperate API call
for offline channels
I didn't have access to logos within the stream call, so I did one call for all channels to /channels/ to get the logo, and then a different call to get the stream info
what I would do is have the offline function just take in one argument for the channel you need to do a separate call on
and then an else after the if(response.stream!=null) that will call that separate API call
if that makes sense
grantknaver
@grantknaver
hard part is to get to the response.stream you need to be in a request
Kevin
@KevinBruland
yeah
I had everything inside of the getJSON
grantknaver
@grantknaver
what do you mean all in everything inside getJSON
Kevin
@KevinBruland
give me a second and I can make an example
grantknaver
@grantknaver
thanks
helpful :)
Kevin
@KevinBruland
here we go
sorry that took so long
so you can see in that example, if data.stream is false, the if statement on line 11 wont fire
so it then goes to the else on line 14, and calls getChannel, passing the channel that did not have data.stream
grantknaver
@grantknaver
I like ajax alot more
Kevin
@KevinBruland
the way you did it?
grantknaver
@grantknaver
no I used getJSON
Kevin
@KevinBruland
ah, right
grantknaver
@grantknaver
I like $.ajax more
Kevin
@KevinBruland
I do too, but you can do simpler getJSON calls as well
Martine Ross
@moi238
@sziko no problem just glad it worked
Baha Aiman
@bhshkh
Thanx @sorinr
CamperBot
@camperbot
bahaaiman sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1013 | @sorinr |http://www.freecodecamp.com/sorinr
Baha Aiman
@bhshkh
For wikipedia viewer I'm getting the error : "Refused to execute script from 'https://en.wikipedia.org/w/api.php?%20%20%20%20format=json%20%20%20%20&acti…plaintext%20%20%20%20&exsentences=1&exlimit=max&gsrsearch=Albert&callback=?' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."
Please help
var app = angular.module('wikiApp', []);
app.controller('myCtrl', function ($scope, $http) {
    $scope.searchUrl = `https://en.wikipedia.org/w/api.php?
    format=json
    &action=query
    &generator=search
    &gsrnamespace=0
    &gsrlimit=10
    &prop=pageimages|extracts
    &pilimit=max
    &exintro
    &explaintext
    &exsentences=1&exlimit=max&gsrsearch=Albert&callback=?`;

    $http.jsonp($scope.searchUrl)
        .success(
        function (data) {
            var results = data.query.pages;
            angular.forEach(results, function (v, k) {
                $scope.results.push({ title: v.title, body: v.extract, page: page + v.pageid })
            })

        });



});
Here's the code
Sorin Ruse
@sorinr
@BahaAiman think you should add into the url that you request a json dataType return. just a sec
Sorin Ruse
@sorinr
@BahaAiman maybe here format=json you should have &format=json
snehashisc
@snehashisc
did that work?
the above code looks good to me. Just append '&'
Minoy
@minoy
Hello everyone!