Note that there are some explanatory texts on larger screens.

plurals
  1. POMaintaining $_SESSION data while making ajax requests through jquery in PHP?
    primarykey
    data
    text
    <p>I'm on the last leg of a decent project (for me at least) and I'm running into an issue where my ajax requests aren't sending $_SESSION data to the URLs they are loading. I'm trying to automate the upload of files you YouTube, using Gdata. I make an ajax request using jquery but when I test for $_SESSION['sessionToken'] in my ajax called PHP script, I get nothing.</p> <p>Here's my code, that's calling the YouTube upload script:</p> <pre><code>function uploadVideos(id, upload, selected) { var status = document.getElementById('currentStatus'); var fields = upload[id].split(":", 2); var token="&lt;?php echo $_GET['token'];?&gt;"; var dataString = 'videoId='+ fields[0]; // + '&amp;token=' + token; id++; status.innerHTML = "&lt;b&gt;Videos for Upload:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;h3 class='status'&gt;Currently Updating Bout #" + fields[1] + " (" + id + " of " + upload.length + " videos)&lt;/h3&gt;"; $.ajax({ type: "GET", url: "upload.php", data: dataString, success: function(txt) { if (txt != 'Success') { alert(txt); } if (id &lt; upload.length) { uploadVideos(id, upload, selected); } else { status.innerHTML = "&lt;b&gt;Videos for Upload:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;h3 class='status'&gt;Completed&lt;/h3&gt;"; } //deselect the checkbox document.videos.video[selected[id-1]].checked = false; document.videos.video[selected[id-1]].style.display = 'none'; }, async: true }); } </code></pre> <p>How can I send sessionToken along to upload.php, to it believes I'm authenticated?</p>
    singulars
    1. This table or related slice is empty.
    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