Facebook Syntax Error All Js
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have javascript syntax error Meta Discuss the workings and policies of this site About Us Learn javascript syntax error code 0 more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us html syntax error Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like
Javascript Syntax Error Checker
you, helping each other. Join them; it only takes a minute: Sign up Syntax error in Javascript? (attempting to dynamically load facebook javascript sdk) up vote 0 down vote favorite The code below seems valid to me; do I really have a syntax error? Running this code in a console: $("body").append($("", { html: " window.fbAsyncInit javascript syntax error unexpected number = function() { "+ " FB.init({"+ " appId : '[valid_id]', // App ID"+ " status : true, // check login status"+ " cookie : true, // enable cookies to allow the server to access the session"+ " xfbml : true // parse XFBML"+ " });"+ " };"+ " (function(d){"+ " var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];"+ " if (d.getElementById(id)) {return;}"+ " js = d.createElement('script'); js.id = id; js.async = true;"+ " js.src = 'https://connect.facebook.net/en_US/all.js';"+ " ref.parentNode.insertBefore(js, ref);"+ " }(document));" })); Returns: SyntaxError: Unexpected end of input javascript jquery facebook-graph-api share|improve this question asked Jul 3 '12 at 16:44 blueberryfields 11.8k1557119 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted After looking at it for a while, it was quite obvious ;-) All your concatenated string parts boil done to one line of JavaScript code eventually – so you can’t use // comments in there, because the go up to where? Exactly, the end of the line! Either strip out t
here for a quick overview of the site Help Center Detailed answers to any questions you javascript syntax error expected expression got ' ' might have Meta Discuss the workings and policies of this site
Javascript Syntax Error Unexpected String
About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Javascript Syntax Error Unexpected End Of Input
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of http://stackoverflow.com/questions/11315442/syntax-error-in-javascript-attempting-to-dynamically-load-facebook-javascript 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up all.js:23 Uncaught SyntaxError: Unexpected token = up vote 1 down vote favorite I get this error all.js:23 Uncaught SyntaxError: Unexpected token = For this code. It worked hours ago... Maybe a temporary bug by facebook script console.info("Init http://stackoverflow.com/questions/9149509/all-js23-uncaught-syntaxerror-unexpected-token Facebook...") window.fbAsyncInit = function () { FB.init({ appId:'1234567890' status:true, // check login status cookie:true, // enable cookies to allow the server to access the session xfbml:true // parse XFBML }); console.info("Facebook SDK running!") }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); javascript facebook facebook-graph-api facebook-javascript-sdk share|improve this question asked Feb 5 '12 at 13:11 fabian 2,07564171 add a comment| 3 Answers 3 active oldest votes up vote 4 down vote Switched to de_DE for the moment. Everything is working for now. js.src = "//connect.facebook.net/de_DE/all.js"; share|improve this answer edited Feb 5 '12 at 13:33 Tim Cooper 86.9k21162181 answered Feb 5 '12 at 13:18 fabian 2,07564171 Any idea what causes this? I'm now experiencing this issue like 4 months after it is posted...and it worked before. –Shawn Mclean Sep 16 '12 at 2:21 add a comment| up vote
reference docs to see which endpoint you want to use. This is a required parameter.methodenum{get, post, delete}This is https://developers.facebook.com/docs/javascript/reference/FB.api the HTTP method that you want to use for the API request. Consult the Graph API reference docs to see which method you need to use. Default is getparamsobjectThis is an object consisting of any parameters that you want to pass into your Graph API call. The parameters that can be used syntax error vary depending on the endpoint being called, so check the Graph API reference docs for full lists of available parameters. One parameter of note is access_token which you can use to make an API call with a Page access token. App access tokens should never be used in this SDK as it is javascript syntax error client-side, and your app secret would be exposed.callbackfunctionThis is the function that is triggered whenever the API returns a response. The response object available to this function contains the API result.Examples Example: Read the JavaScript Facebook Page: FB.api('/113124472034820', function(response) { console.log(response); }); Example: Return the last name of the current user: FB.api('/me', {fields: 'last_name'}, function(response) { console.log(response); }); Example: Publish a status message to the current user's feed: var body = 'Reading JS SDK documentation'; FB.api('/me/feed', 'post', { message: body }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } }); Example: Delete a previously published post: var postId = '1234567890'; FB.api(postId, 'delete', function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post was deleted'); } }); Example: Reading a Page's messages using a Page Access Token: var pageAccessToken = '1234567890|faketoken'; FB.api('/me/conversations', { access_token : pageAccessToken });