How to set a javascript date variable equal to the result from a report query
Trying to pull a date field value into a javascript variable from a QB table. Right now I am calculating the value of the variable (as shown below)...but I need to modify this script to pull the value from a report in QB which returns a single record in the result.
Here's part of the code:
var queryStr = '';
var dbID = 'xxxxxx';
var payPeriodsTable = 'xxxxxx';
var byDayTable = 'xxxx';
$(document).ready(function(){
var currentTime = new Date();
// I need to replace the line below with code that will set newDate equal to a date field from
// a QB table.
var newDate = new Date(currentTime.getFullYear(), currentTime.getMonth()+1,
currentTime.getDate() + 4-currentTime.getDay());
var endDate = new Date();
//var newDate = new Date("April 22, 2012");
if( (newDate-currentTime) <=0 ) {
newDate.setDate( newDate.getDate()-7 );
}
endDate.setDate(newDate.getDate()+13);
$('#new_date').val( newDate.getMonth() + '/' + newDate.getDate() + '/' + newDate.getFullYear() );
$('#end_date').val( endDate.getMonth() +1 + '/' + endDate.getDate() + '/' + endDate.getFullYear() );
$('#start_button').click(function() {
$('#start_button').hide();
$('#please_wait').show();
$("#new_date").attr("disabled", true);
startPopulation();
$('#please_wait').hide();
});
});

