Jump to content

Pass PHP ID with Ajax request


rx3mer

Recommended Posts

Hi guys,

 

I am trying to figure out how to pass PHP ID  (page.php?id= 'id' ") with ajax request.

 

Getting the ID and storing it into variable called "playlistsongid"

<?php 
  session_start();
  if(!isset($_GET['id'])) die("No id set"); ?>

<?php $playlistsongid = $_GET['id']; ?>
function setupyoutubesongarray(firstload) {
  $.ajax({
   'url': 'post.php',
   'async': false,
    success: function (response) {

        var posturl="post.php"; // needs to looks something like post.php?id=
        $.getJSON(posturl,function(data){
          youtubesongs = [];
          $.each(data.members, function(i,song){
            result = (song.SongUrl);
              youtubesongs.push(result);
            //ytplayer_playlist.push(result);
          });
          
          loadnextbatchfromsongsarray();
          if (firstload = 1) {
            ytplayer_render_player();
          }
        });
    }
  });
}

Any help would be much apreceated!

Link to comment
https://forums.phpfreaks.com/topic/286227-pass-php-id-with-ajax-request/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.