Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP var displays in Chrome Dev Tool, but not webpage
    text
    copied!<p>I have this issue where, I can see the echo of a variable via the preview on Chrome Developer Tools, but it's blank on the actual web page.</p> <p>I am guessing this is down to a timing issue, so to make it clear this is how I have it.</p> <ul> <li>As page (index.php) loads, it links a .js file that does a FLQ query on FB to get the users name.</li> <li>It then uses ajax to repost to the index.php with the information.</li> <li>Back at the index.php page, it reloads and collects via $_POST</li> <li>It then displays some of the user info held in $_POST</li> </ul> <p>I am guessing why I am doing is not possible, but it's odd that in the Chrome dev tool, all the variables echo on the page, but the actual page is blank where the variable should display.</p> <p>I can only suggest I have a holding page, collect the detail and then load then moves to the main page to display the data.</p> <pre><code>&lt;!-- Index.php --&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;?php global $uid; global $una; global $uem; global $uph; ?&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; // initialize the library with the API key FB.init({ apiKey: '2847xxxxxxxx689' }); &lt;/script&gt; &lt;?php ?&gt; &lt;script type="text/javascript"&gt; FB.login(function(response) { // handle the response }, {scope: 'email,publish_stream'}); &lt;/script&gt; &lt;script type="text/javascript" src="jquery/op.js"&gt;&lt;/script&gt; &lt;?php $uid = $_POST['uid']; $una = $_POST['una']; $uem = $_POST['uem']; $uph = $_POST['uph']; echo $_POST['una']; ?&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;link rel="stylesheet" href="stylesheets/op_main.css" media="Screen" type="text/css" /&gt; &lt;?php //include('assets/opPHP.php'); include('sql/ajaxsql.php'); include('sql/phpsql.php'); $opapp = new opapp; ?&gt; &lt;body&gt; &lt;div id="mainbody"&gt; &lt;div id="topbanner"&gt; Beta Name &lt;?php echo $una; ?&gt; &lt;/div&gt; &lt;-- .js File --&gt; $(window).load(function() { FB.api('/me', function(response) { var query = FB.Data.query('select uid,name,email, pic_square from user where uid={0}', response.id); query.wait(function(rows) { var uid = rows[0].uid; var una = rows[0].name; var uem = rows[0].email; var uph = '&lt;img src="' + rows[0].pic_square + '&gt;'; $.ajax({ url: '../index.php', type: 'POST', data: 'uid=' + uid + '&amp;una=' + una + '&amp;uem=' + uem + '&amp;uph=' + uph }); }); }); }); </code></pre> <p>I can see it posts the information, so my question is. Is their another way to collect the information, while being on the same page. Even explain why I can see it it dev tool, but not the main page?</p> <p>Thanks</p> <p>Andrew</p>
 

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