i have been searching this wonderful site of information but havent found exactly what im looking for, only bits and pieces .
Im fairly new to the whole JavaScript language/jQuery library but im begining to love it more and more with the things you can do with it.
I have a file, array.php, that print out json formatted variable with certain dates that i want to disable in a .datepicker calendar.
I have got the whole thing working except the variable from sql part.
This works: var $BadDates = new Array("2012-05-28","2012-05-29","2012-05-30");
What i would like is something like this:
$.getJSON('array.php', function(data) {
var $BadDates = [];
}
My array.php:
$query = "SELECT * FROM dates";
$query_result = mysql_query($query) or die(mysql_error());
$results = array();
while($row = mysql_fetch_assoc($query_result)) {
$n["startdate"] = $row['startdate'];
array_push($results, $n);
}
print json_encode($results);
This is what i want to accomplish (i know its all wrong, just so i can show how im thinking):
$BadDates = new Array("$.getJSON('array.php')");
Have been checking out many solutions without any luck...
I appreciate all the help i can get!
/Oskar