AJAX refresh works outside DIV but not inside. Is there a way to fix this.

I have a tab that successfully updates via AJAX when selecting a date from an array query placed in a separate div. This works perfectly for supplying a drop-down populated with the dates in the field 'cb_dldate1' but now i am trying to write the AJAX target for refreshing the data connected to the date field (cb_dldate1) and the queries are totally different. Somehow developer changed the method for calling fields from the data base and the date database query is not populating the drop down. All other information is refreshed perfectly. I will supply any code needed to better understand this.

Below is the active code that works and then the code that does not.

Please help me find out how to call more that one array in the second method that currently is not working.

Thank you all for your time,
gorg

///CODE THAT WORKS///
 
$query = "SELECT d.cf_user_id, d.recordtime, d.trscore, d.cb_dldate1, d.cb_dltext2, d.cb_dltext3,d.cb_dltext4, d.cb_dlselect2, d.cb_dlselect6, d.cb_dlselect3, d.cb_dlselect5, d.cb_dlselect7, d.cb_dlselect9, d.cb_dlselect8, d.cb_dltext5, d.cb_dltext6, d.cb_dltext7, d.cb_dltext8, d.cb_dltext9, d.text_2, d.cb_dltext10, d.ipaddress, d.cf_id, u.email, u.username , u.gid , u.id AS userid FROM #__daily_logging AS d, #__users AS u WHERE u.id = $user->id AND d.cf_user_id = $user->id ORDER BY d.cb_dldate1 DESC";
 
$_CB_database->setQuery($query);
 
$results = $_CB_database->loadObjectList();	
	
$query = 	"SELECT
cf_id, text_3, text_4, text_7, text_5, text_8
FROM #__committo42_dietsheet
WHERE cf_user_id = $user->id AND date_1 = '" . $results[0]->cb_dldate1 ."'
ORDER BY CAST(text_4 AS DATETIME) DESC";
		
$_CB_database->setQuery($query);
$dietsheet = null;
$dietsheets = $_CB_database->loadObjectList($dietsheet);
 
 
/// CODE THAT DOES NOT WORK  ///
 
$query = "SELECT d.cf_user_id, d.recordtime, d.trscore, d.cb_dldate1, d.cb_dltext2, d.cb_dltext3,d.cb_dltext4, d.cb_dlselect2, d.cb_dlselect6, d.cb_dlselect3, d.cb_dlselect5, d.cb_dlselect7, d.cb_dlselect9, d.cb_dlselect8, d.cb_dltext5, d.cb_dltext6, d.cb_dltext7, d.cb_dltext8, d.cb_dltext9, d.text_2 FROM jos_daily_logging AS d WHERE d.cf_user_id = '$user_id' ORDER BY d.cb_dldate1 DESC";
 
$rowSet = MYSQL_QUERY($query);
	while($row = mysql_fetch_object($rowSet)) {
		if ($row->cb_dldate1 == $date) {
			$result = $row;
		}
  }
 
$query = 	"SELECT 
		cf_id, text_3, text_4, text_7, text_5, text_8 
		FROM jos_committo42_dietsheet 
		WHERE cf_user_id = '$user_id' AND date_1 = '$date' ORDER BY text_4";
 
	$rowSet = MYSQL_QUERY($query);
 
	// Storing dietsheets to array.
	$i = 0;
	while($row = mysql_fetch_object($rowSet)) {
		$dietsheets[$i] = $row;
		$i++;
	}

Open in new window

fun_gAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cdaugustinCommented:
hi,

The whole script seems fairly complex (not just the bit which I can see here) I am sugesting calling this specific script from the browser (using the params the ajax call is sending) and somewhere at the top of the page put error_reporting(E_ALL); and after each query do a echo $query; to see if the script fully executes and to see what queries it tries to execute. If you get the queries take them and copy/paste them directly in the db engine and see if they return the correct data. If thats the case  and if the output of your script matches the one expected, than maybe you have a JS error in the page (check if one appears when you chage tabs)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.