So I was having trouble returning a request to a server for an api. I then chose to use Jsonp to return the data. I get the data in the response, but my javascript console says that there is a
syntaxError: expecting expression, got '<'.
Does anyone know if this is some sort of security response from the server since I am doing a cross domain request to this api?
Here is my angular controller
app.controller('bibleController', function ($scope, $http, bibleService) {
//Get A chapter from the bible
$scope.search = function() {
return $http.jsonp("http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=" + $scope.bo + $scope.chap, {
}).success(function (data, status, headers, config) {
$scope.output = "help"; //this is what you're after.
}).error(function (data, status, headers, config) {
$scope.Message = "Oops... something went wrong";
});
}
});
I'd really like to know what's up. I would like to return JSON for angular, but this server only returns xml or html. I am getting back html. Here is the response.
<div class="esv"><h2>James 2 <object type="application/x-shockwave-flash" data="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F59002001-59002026" width="40" height="12" class="audio"><param name="movie" value="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F59002001-59002026" /><param name="wmode" value="transparent" /></object></h2>
<div class="esv-text"><h3 id="p59002001.01-1">The Sin of Partiality</h3>
<p id="p59002001.05-1"><span class="chapter-num" id="v59002001-1">2:1 </span>My brothers,<span class="footnote"> <a href="#f1" id="b1" title="Or 'brothers and sisters'; also verses 5, 14">[1]</a></span> show no partiality as you hold the faith in our Lord Jesus Christ, the Lord of glory. <span class="verse-num" id="v59002002-1">2 </span>For if a man wearing a gold ring and fine clothing comes into your assembly, and a poor man in shabby clothing also comes in, <span class="verse-num" id="v59002003-1">3 </span>and if you pay attention to the one who wears the fine clothing and say, “You sit here in a good place,” while you say to the poor man, “You stand over there,” or, “Sit down at my feet,” <span class="verse-num" id="v59002004-1">4 </span>have you not then made distinctions among yourselves and become judges with evil thoughts? <span class="verse-num" id="v59002005-1">5 </span>Listen, my beloved brothers, has not God chosen those who are poor in the world to be rich in faith and heirs of the kingdom, which he has promised to those who love him? <span class="verse-num" id="v59002006-1">6 </span>But you have dishonored the poor man. Are not the rich the ones who oppress you, and the ones who drag you into court? <span class="verse-num" id="v59002007-1">7 </span>Are they not the ones who blaspheme the honorable name by which you were called?</p>
<p id="p59002008.01-1"><span class="verse-num" id="v59002008-1">8 </span>If you really fulfill the royal law according to the Scripture, “You shall love your neighbor as yourself,” you are doing well. <span class="verse-num" id="v59002009-1">9 </span>But if you show partiality, you are committing sin and are convicted by the law as transgressors. <span class="verse-num" id="v59002010-1">10 </span>For whoever keeps the whole law but fails in one point has become accountable for all of it. <span class="verse-num" id="v59002011-1">11 </span>For he who said, “Do not commit adultery,” also said, “Do not murder.” If you do not commit adultery but do murder, you have become a transgressor of the law. <span class="verse-num" id="v59002012-1">12 </span>So speak and so act as those who are to be judged under the law of liberty. <span class="verse-num" id="v59002013-1">13 </span>For judgment is without mercy to one who has shown no mercy. Mercy triumphs over judgment.</p>
<h3 id="p59002014.01-1">Faith Without Works Is Dead</h3>
<p id="p59002014.06-1"><span class="verse-num" id="v59002014-1">14 </span>What good is it, my brothers, if someone says he has faith but does not have works? Can that faith save him? <span class="verse-num" id="v59002015-1">15 </span>If a brother or sister is poorly clothed and lacking in daily food, <span class="verse-num" id="v59002016-1">16 </span>and one of you says to them, “Go in peace, be warmed and filled,” without giving them the things needed for the body, what good<span class="footnote"> <a href="#f2" id="b2" title="Or 'benefit'">[2]</a></span> is that? <span class="verse-num" id="v59002017-1">17 </span>So also faith by itself, if it does not have works, is dead.</p>
<p id="p59002018.01-1"><span class="verse-num" id="v59002018-1">18 </span>But someone will say, “You have faith and I have works.” Show me your faith apart from your works, and I will show you my faith by my works. <span class="verse-num" id="v59002019-1">19 </span>You believe that God is one; you do well. Even the demons believe—and shudder! <span class="verse-num" id="v59002020-1">20 </span>Do you want to be shown, you foolish person, that faith apart from works is useless? <span class="verse-num" id="v59002021-1">21 </span>Was not Abraham our father justified by works when he offered up his son Isaac on the altar? <span class="verse-num" id="v59002022-1">22 </span>You see that faith was active along with his works, and faith was completed by his works; <span class="verse-num" id="v59002023-1">23 </span>and the Scripture was fulfilled that says, “Abraham believed God, and it was counted to him as righteousness”—and he was called a friend of God. <span class="verse-num" id="v59002024-1">24 </span>You see that a person is justified by works and not by faith alone. <span class="verse-num" id="v59002025-1">25 </span>And in the same way was not also Rahab the prostitute justified by works when she received the messengers and sent them out by another way? <span class="verse-num" id="v59002026-1">26 </span>For as the body apart from the spirit is dead, so also faith apart from works is dead. (<a href="http://www.esv.org" class="copyright">ESV</a>)</p>
</div>
<div class="footnotes">
<h3>Footnotes</h3>
<p><span class="footnote"><a href="#b1" id="f1">[1]</a></span> <span class="footnote-ref">2:1</span> Or <em>brothers and sisters</em>; also verses 5, 14
<br />
<span class="footnote"><a href="#b2" id="f2">[2]</a></span> <span class="footnote-ref">2:16</span> Or <em>benefit</em>
</p>
</div>
</div>
General and response header
Remote Address:75.101.167.237:80
Request URL:http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=james2
Request Method:GET
Status Code:200 OK (from cache)
Response Headers
Content-Length:5583
Content-Location:passageQuery.php
Content-Type:text/html
Date:Tue, 08 Sep 2015 18:19:13 GMT
Expires:Wed, 09 Sep 2015 18:19:13 +0000
Server:nginx/0.7.62
TCN:choice
Vary:negotiate
X-Powered-By:PHP/5.2.10-2ubuntu6.4
Query string and request headers
Provisional headers are shown
Accept:*/*
Referer:http://localhost:59324/
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Query String Parameters
view source
view URL encoded
key:IP
passage:james2
I would really like to get this api working!