I am running javascript variables from Mysql using PHP with Ajax/JSON. My original question can be found here: from mysql to javascript variable. Basically I now am having an issue with the variables being recognised throughout the remainder of the script. On my last question you see the two variables go from:
var tag_name = 'example';
var client_id = '123456789';
To now using (Thank you @Richard Rodriguez):
$.ajax({
url: 'call.php',
dataType: 'json'
}).done(
function(data){
var tag_name = data[0];
var client_id = data[1];
}
);
I believe the issue might just be a javascript function conflict? Here is a link to the script I am trying to modify from github: https://raw.github.com/ryancw/instagram-scroll/master/instagram-scroll.js. I hope seeing the original file can help diagnose what is causing the issue? I researched for that the last 2 hours with no luck. Any suggestions or even links to good articles on javascript function conflicts (if that is the issue) will be a great help.
EDIT (Full Code):
var tag_name = null;
var client_id = null;
var thumb_dimension = null;
var div_to_add_pics = null;
var include_caption = null;
var include_username = null;
var url = null;
function processData() {
console.log(tag_name);
console.log(thumb_dimension);
console.log(div_to_add_pics);
console.log(include_caption);
console.log(include_username);
console.log(url);
}
$.ajax({
url: 'call.php',
dataType: 'json'
}).done(
function(data){
tag_name = data[0];
client_id = data[1];
thumb_dimension = 220;
div_to_add_pics = '#img';
include_caption = false;
include_username = false;
url = 'https://api.instagram.com/v1/tags/'+tag_name+'/media/recent?client_id='+client_id;
processData();
}
);