{"id":3073,"date":"2014-03-15T03:37:36","date_gmt":"2014-03-15T03:37:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/15\/jsonpangularjsrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-03-15T03:37:36","modified_gmt":"2014-03-15T03:37:36","slug":"jsonpangularjsrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/15\/jsonpangularjsrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"jsonp,angularjsRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7e217990c577c8bde260ab2244dee183?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbigmattyh<br \/>\njavascript jquery json jsonp<br \/>\nI&#8217;m using jQuery&#8217;s ajax function to hit a cross domain url. The url will return json. I&#8217;m in the discovery phase with this but I think, because the json values contain several &#8216;&amp;quot&#8217; strings, the json eval is throwing an error and stopping the execution of my client side script. The error that I get is &#8220;unterminated string literal&#8221;. I know that if I hard-code the returned json by putting it in a local div and remove the &#8216;&amp;quot;&#8217; strings (and a couple of hidden special characters), I can<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/71770d043c0f7e3c7bc5f74190015c26?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nthe Tin Man<br \/>\nruby-on-rails ruby jquery-ajax jsonp<br \/>\nI have a problem with cross-domains. I am using JSONP in an Ajax call, and I got the data successfully but I got the following error:Uncaught SyntaxError: Unexpected token :Here is my response:{&#8220;models&#8221;: [{ &#8220;id&#8221;:828525, &#8220;code&#8221;:null, &#8220;reselling_name&#8221;:&#8221;Race-Dezert.com&#8221;, &#8220;expose_domains&#8221;:false, &#8220;state&#8221;:&#8221;active&#8221; }]}<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/edd8638efe875601bfe394a8aea5b16d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbrian d foy<br \/>\njsonp sencha-touch-2<br \/>\nI am retrieving information for a List via JSONP and am getting the following error in console browser: &#8220;unexpected token : &#8220;My store:Ext.define (&#8216;Projeto.store.Mural&#8217;, {extend &#8216;Ext.data.Store&#8217;requires: [&#8216;Projeto.model.Mural&#8217;]config: {autoLoad: true,model: &#8216;Projeto.model.Mural&#8217;storeId &#8216;MuralStore&#8217;Proxy {type: &#8216;jsonp&#8217;url: &#8216;http:\/\/URL\/mural&#8217;reader: {type: &#8216;json&#8217;,rootProperty: &#8216;rows&#8217;}}} });My List:Ext.define (&#8216;Projeto.view.MuralList&#8217;, {extend &#8216;Ext.dataview.List&#8217;alias: &#8216;widget.murallist&#8217;config: {loa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/oewbx.jpg?s=32&amp;g=1\" \/><br \/>\nMina Gabriel<br \/>\nc# ajax vb.net web-services jsonp<br \/>\nI have a very basic &#8211; for testing &#8211; ASP.net Web service (2.0 and IIS 6.0) written in VB running on a remote server WEB SERVICE &lt;WebService(Namespace:=&#8221;CMS_ChecklistSystemWebService&#8221;)&gt; _&lt;WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _&lt;Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()&gt; _&lt;System.Web.Script.Services.ScriptService()&gt; _Public Class CMS_ChecklistSystemWebServiceInherits System.Web.Services.WebService&lt;WebMethod()&gt; _Public Funct<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Yc1Aj.jpg?s=32&amp;g=1\" \/><br \/>\nAndrei Bouariu<br \/>\nc# xml wcf parsing jsonp<br \/>\nI have a WCF Service with a function named GetTrackingLink:[WebInvoke(Method = &#8220;GET&#8221;, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] public BasicResponse GetTrackingLink(string orderID) {BasicResponse response = new if (orderID == null)response.Status = &#8220;null&#8221;;elseresponse.Status = &#8220;not null&#8221;;return response; }I call this function from another page, using the following script:$.ajax({ type: &#8216;GET&#8217;, url: &#8216;http:\/\/localhost:14113\/Service1.svc\/GetTrackingLink&#8217;, crossD<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2d03711e4e5e22ff1ad1a9191725ae2a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrGil<br \/>\najax angularjs google-apps-script jsonp<br \/>\nThe specs for receiving jsonp from google apps script are not causing an &#8220;unexpected token&#8221; in the return data.I&#8217;m using angularjs $http.jsonp &#8211; it doesn&#8217;t like the syntax ?prefix=? at the end of my url to the google apps script. This works fine with jQuery, but I&#8217;m trying to go all angular with this app. Here is a fiddle I forked from a previous user. Here is the request, which is fine:function jsonp_example($scope, $http) { $scope.doRequest = function() {var url = &#8220;https:\/\/script.google.co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e9d071815d65c17476e90cedbedba229?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAndrewSpear<br \/>\njavascript jquery ajax jsonp metrics<br \/>\nI am trying to integrate the Kissmetrics API into our site, essentially I just need to ping a URL on their server to record that an action took place. Here is an example URL:http:\/\/trk.kissmetrics.com\/e?_k=APIKEY&amp;_p=USERID&amp;_n=ACTIONIf you visit that URL you&#8217;ll notice it returns a transparent GIF. I can&#8217;t just place the GIF on my page inside an tag because it must be pinged in the middle of a stack of javascript rather than on an HTML page load. Being a remote file, I need to call it wit<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/675947cc1a4932d6adb30f96e9897840?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nk4kuz0<br \/>\njavascript jquery ajax json jsonp<br \/>\nI&#8217;ve been trying to pull data from the steam api, and have had no luck because I always get the above error. Here is the code I am using:var steamurl = &#8220;https:\/\/api.steampowered.com\/IDOTA2Match_570\/GetMatchHistory\/V001\/?key=[keyomitted]&amp;account_id=38440257&amp;Matches_Requested=10&#8221;; function populate_api(){var json;$.ajax({ &#8216;url&#8217;: steamurl,&#8217;dataType&#8217;: &#8220;jsonp&#8221;,&#8217;success&#8217;: function (data) {alert(&#8216;success&#8217;);json = data;}}); }I omitted my API key. I have looked at many other posts, and cannot fig<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0ce15ea7e32a97fed041e271fa046c73?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ngladsocc<br \/>\njavascript jquery json jsonp<br \/>\nI get the following error when I try to get info from the mtgox API. In chrome I can see that using jsonp is working, and there&#8217;s no cross domain errors:$.ajax({type: &#8216;GET&#8217;,url: &#8216;https:\/\/mtgox.com\/api\/1\/BTCUSD\/ticker?callback=?&#8217;,async: false,contentType: &#8216;application\/json&#8217;,dataType: &#8216;jsonp&#8217;,success: function(json) {console.log(&#8216;ok&#8217;);} });<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/467e9f38cbb5f5ecddb8f274c1d74c5a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPaparazzoKid<br \/>\njquery ajax json cross-domain jsonp<br \/>\nI am building a simple app for a platform called Mixi, which is like Facebook in Japan. Now, in the Javascript API I am trying to fetch user&#8217;s profile information as per given API and after passing the correct auth token. The API link works perfect if I trigger it from my address bar in the browser. But, after hours of fiddling with it, and trying JSONP and all possible variants which I could find, Chrome&#8217;s console does show data but only when I click on this error:Uncaught SyntaxError: Unexpect<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/45e32cd84b574d8a8867f97b30a0d0b6?s=128&amp;d=identicon&amp;r=PG\" \/><br \/>\nP____<br \/>\njavascript angularjs<br \/>\nI wrote out the last example on the angular website (angularjs.org\/#create-components), but I&#8217;m not able to get the desired output.Here is my code:index.html, components.js,and app.js is at pastebin.com\/XDpSkHBb (but StackOverflow doesn&#8217;t letme use more than 2 links)I think the error is with &lt;html ng-app=&#8221;app&#8221;&gt;because when I replace it with &lt;html ng-app&gt;the Date: {{ &#8216;2012-04-01&#8242; | date:&#8217;fullDate&#8217; }}are replaced with Date: Sunday, April 1, 2012however, that means I&#8217;m no longer accessi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bca89126101061fe446c63ebdb546409?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWillem Mulder<br \/>\nangularjs angularjs-directive directive<br \/>\nI&#8217;m trying to test a Directive in Angular, but I can&#8217;t get the corresponding template to work.The directive lists the templateUrl like sotemplateUrl: &#8216;directives\/listview\/view.html&#8217;Now when I write any unit-test, I getError: Unexpected request: GET directives\/listview\/view.htmlSo I have to use the $httpBackend and respond with something sensible like httpBackend.whenGET(&#8216;directives\/listview\/view.html&#8217;).respond(&#8220;&lt;div&gt;som&lt;\/div&gt;&#8221;);But really I want to simply return the actual file, and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ed0cf4c765b1f8197ec1b5df5441ca96?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser3243186<br \/>\njavascript php json angularjs<br \/>\nI echo two thing like PHPecho json_encode($obj); echo json_encode($obj2);and how I receive it? I thought everything will be fall into the data param. But I got an error saying SyntaxError: Unexpected token {at Object.parse (native)$http({ method: &#8216;GET&#8217;, url: &#8216;path&#8217; }). success(function(data, status, headers, config) {}<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6c3935e8e58cdd1c3c970c54d81d6688?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohn<br \/>\nruby-on-rails-3 angularjs haml<br \/>\nI&#8217;m using Angularjs in parts of my Rails app, which works great. But I&#8217;m wondering how to use an Angular value inside a link_to. Here is my pseudo code:%table %tr{&#8220;ng-repeat&#8221; =&gt; &#8220;book in books&#8221;}%td{{book.title}}%td= link_to &#8220;Show&#8221;, book_url({{book.id}})This gives me an error: syntax error, unexpected &#8216;}&#8217;, expecting tASSOCThis could also have to do with HAML causing the error, but how can I send the ID in the link_to?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8fff1762545454ea62f60c5b5634bc5f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlexandru Rada<br \/>\nangularjs<br \/>\nI&#8217;m having an issue with a conditional ng-class on an element like this:&lt;div class=&#8221;control-group&#8221; ng-class=&#8221;{error: checkTemplate()==&#8217;html'&#8221;&gt;the function does some checks and returns an error code. I want to check the returned code and if it&#8217;s html, to add the error class.However, this generats an error:Syntax Error: Token &#8216;undefined&#8217; is unexpected, expecting [}] at column NaN of the expression [{error: checkTemplate()==&#8217;html&#8217;] starting at [{error: checkTemplate()==&#8217;html&#8217;].What&#8217;s the prob<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6f199c1db380b547cee89af9ac40ef28?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJoel Pearson<br \/>\ndebugging google-chrome angularjs webstorm<br \/>\nI followed Vojta&#8217;s video about how to do debug angularjs in Webstorm.http:\/\/www.youtube.com\/watch?v=MVw8N3hTfCI&amp;feature=plcpHowever, every time I stop the testacular server in webstorm. I have to reinstall the webstorm debug extension for chrome. Am I doing something wrong? Do I need to install it into some Chrome profile or something?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/20c85a9b16269f19a2baf1123c993556?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nBramha<br \/>\nangularjs angularjs-directive<br \/>\nI have written watch on pubInfoKey, But its not working properly when I set value to pubInfoKey in select function. What can be the problem here, I want to call Controller changeState method on pubInfoKey value changeDirective&#8217;s link function :link: function(scope, element, attrs, ngModelCtrl, state) { var pubInfoKey; scope.$watch(&#8216;pubInfoKey&#8217;, function(val) {if (val) {$scope.changeState(val);} } );var autoSuggest = element.autocomplete({select: function(event, ui) {var i = 0;for (i = 0; i &lt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ddd69f0a29f68d7a338cd76953ef43fc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAnup<br \/>\njavascript node.js angularjs<br \/>\nI am trying to replace placeholders in a email template, Following is my code:-I am getting the error : Don&#8217;t make functions within a loopvar dataPlaceholders = [{&#8220;username&#8221;:&#8221;John Johny&#8221;,&#8221;website&#8221;:&#8221;w3schools . com&#8221;}];template_html = &#8220;&lt;b&gt;Hello &lt;%= username %&gt;,&lt;\/b&gt;&lt;br\/&gt;&lt;br\/&gt; You are successfuly Registered on xyz.&lt;br\/&gt;&lt;br\/&gt;Thank you &lt;%= website %&gt;&#8221;;function call :-function ReplacePlaceholders(dataPlaceholders, template_html){for (var i = 0; i &lt; dat<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/cEjMm.gif?s=32&amp;g=1\" \/><br \/>\ndopplesoldner<br \/>\nhtml angularjs<br \/>\nI have a HTML page and I am trying to include some js files like &lt;script type=&#8221;text\/javascript&#8221; src=&#8221;..\/bower_components\/jquery\/jquery.js&#8221;&gt;&lt;\/script&gt;But I keep getting Resource interpreted as Script but transferred with MIME type text\/html: &#8220;http:\/\/localhost:8080\/bower_components\/jquery\/jquery.js&#8221;. followed by Uncaught SyntaxError: Unexpected token &lt; jquery.js:1in the developer console. I am trying some tutorials on angular.js and node.jsSolved http:\/\/stackoverflow.com\/a\/21823343\/<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bb29243b181d4b3d53cb17dcf44f45cc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSteve Davis<br \/>\nangularjs<br \/>\nWhen attempting to use the following regex pattern with ng-pattern: [(?=^.{8,100}$)((?=.*[a-zA-Z])(?=.*\\d)|(?=.*[a-zA-Z])(?=.*\\W)|(?=.*\\W)(?=.*\\d)).*$]angular js throws a lexer error: Lexer Error: Unexpected next character at columns 34-34 [] in expressionHow do you escape the offending character which I believe is the backslash ().<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>bigmattyh javascript jquery json jsonp I&#8217;m using jQuery&#8217;s ajax function to hit a cross domain url. The url will return json. I&#8217;m in the discovery phase with this but I think, because the json values contain several &#8216;&amp;quot&#8217; strings, the json eval is throwing an error and stopping the execution of my client side script. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3073","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3073"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3073\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}