Note that there are some explanatory texts on larger screens.

plurals
  1. POfacebook using jquerymobile frame work
    primarykey
    data
    text
    <p>I am trying to implement the basic features of facebook like updating the facebook profile, and also facebook login using jquerymobile frame work. Using this link <a href="http://thinkdiff.net/facebook/graph-api-javascript-base-facebook-connect-tutorial/" rel="nofollow">http://thinkdiff.net/facebook/graph-api-javascript-base-facebook-connect-tutorial/</a></p> <p>It works fine with HTML 5 format. But when I integrate with the JqueryMobile, I am getting an error which says Uncaught exception: cant call method appendChild.</p> <p>I will paste the code here: please have a look and let me know whats the problem.</p> <pre><code>&lt;body&gt; &lt;script type="text/javascript"&gt; window.fbAsyncInit = function() { FB.init({appId: 'xxxxxxxxxxxxxx', status: true, cookie: true, xfbml: true}); /* All the events registered */ FB.Event.subscribe('auth.login', function(response) { // do something with response login(); }); FB.Event.subscribe('auth.logout', function(response) { // do something with response logout(); }); FB.getLoginStatus(function(response) { if (response.session) { // logged in and connected user, someone you know login(); } }); }; (function() { var e = document.createElement('script'); e.type = 'text/javascript'; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); //i am getting error in the is line }); function login(){ FB.api('/me', function(response) { document.getElementById('login').style.display = "block"; document.getElementById('login').innerHTML = response.name + " succsessfully logged in!"; }); } function logout(){ document.getElementById('login').style.display = "none"; } //stream publish method function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){ FB.ui( { method: 'stream.publish', message: '', attachment: { name: name, caption: '', description: (description), href: hrefLink }, action_links: [ { text: hrefTitle, href: hrefLink } ], user_prompt_message: userPrompt }, function(response) { }); } function showStream(){ FB.api('/me', function(response) { //console.log(response.id); streamPublish(response.name, 'Something ', 'hrefTitle', 'http://www.ffff.com', "Share www.ffffff.com"); }); } function share(){ var share = { method: 'stream.share', u: 'http://www.fffffff.com' }; FB.ui(share, function(response) { console.log(response); }); } function graphStreamPublish(){ var body = 'hsdfkjasdkjfadkjf;adlfj'; FB.api('/me/feed', 'post', { message: body }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } }); } function fqlQuery(){ FB.api('/me', function(response) { var query = FB.Data.query('select name, hometown_location, sex, pic_square from user where uid={0}', response.id); query.wait(function(rows) { document.getElementById('name').innerHTML = 'Your name: ' + rows[0].name + "&lt;br /&gt;" + '&lt;img src="' + rows[0].pic_square + '" alt="" /&gt;' + "&lt;br /&gt;"; }); }); } function setStatus(){ status1 = document.getElementById('status').value; FB.api( { method: 'status.set', status: status1 }, function(response) { if (response == 0){ alert('Your facebook status not updated. Give Status Update Permission.'); } else{ alert('Your facebook status updated'); } } ); } &lt;/script&gt; &lt;div data-role="page"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;Foofys-Facebook Page&lt;/h1&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div data-role="content"&gt; &lt;p&gt;you are using foofys facebook app&lt;/p&gt; &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"&gt; &lt;/fb:login-button&gt; &lt;p&gt; &lt;a href="#" onclick="showStream(); return false;"&gt;Publish Wall Post&lt;/a&gt; | &lt;!-- &lt;a href="#" onclick="share(); return false;"&gt;Share With Your Friends&lt;/a&gt; | --&gt; &lt;a href="#" onclick="graphStreamPublish(); return false;"&gt;Publish Stream&lt;/a&gt; | &lt;!-- &lt;a href="#" onclick="fqlQuery(); return false;"&gt;FQL Query Example&lt;/a&gt; --&gt; &lt;/p&gt; &lt;textarea id="status" cols="50" rows="5"&gt;Write your status here'&lt;/textarea&gt; &lt;br /&gt; &lt;!-- &lt;a href="#" onclick="setStatus(); return false;"&gt;Status Set Using Legacy Api Call&lt;/a&gt; --&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;div id="login" style ="display:none"&gt;&lt;/div&gt; &lt;div id="name"&gt;&lt;/div&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;div data-role="footer"&gt; &lt;h4&gt;Page Footer&lt;/h4&gt; &lt;/div&gt;&lt;!-- /footer --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; </code></pre> <p>i am not able to understand whats happening in the code, BTW I have just pointed where exactly I am getting the error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload