Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass Javascript variables inside a URL? AJAX

i am trying to pass the values of accesstoken and pageid inside the url that i use. Any ideas how to do it correctly?

<script type="text/javascript">   
function makeUrl() {
    var accesstoken = "12345679|bababashahahhahauauuaua";
    var pageid =  "<?php echo $page_id;?>";
 $.ajax(
  {
    url: 'https://graph.facebook.com/?pageid/?access_token='+pageid+accesstoken,
 statusCode: {......
like image 961
Spyros_av Avatar asked Jul 09 '15 15:07

Spyros_av


1 Answers

Change

url: 'https://graph.facebook.com/?pageid/?access_token='+pageid+accesstoken,

to

url: 'https://graph.facebook.com/?pageid='+pageid+'&access_token='+accesstoken,
like image 200
Imran Avatar answered Sep 25 '22 19:09

Imran