radar Posted August 7, 2010 Share Posted August 7, 2010 Alright working on a site, getting my navigation working.... only thing is it doesn't work... function changeNav(url) { var myRand = parseInt(Math.random()*99999999); var srcs = url+'&ints='+myRand; $('TransMsgDisplay').innerHTML = '<p><img src="templates/site/images/indicator.gif" align="center"></br>Loading Page, Please Wait.</p>'; var myAjax = new Ajax.Request( srcs, { method: 'get', onComplete: processNav }); } function processNav(originalRequest) { var responseTextTrim=trim(originalRequest.responseText); $('TransMsgDisplay').innerHTML=responseTextTrim; } that is my ajax-cs.js file. then my php: case about: ########### BEGINNING OF ABOUT PAGE ############ $sql = "SELECT aboutTxt FROM about"; $data = mysql_result(mysql_query($sql), 0); $ybd->assign('data', $data); $page = 'flat_text.tpl'; break; ################ END OF ABOUT PAGE ################## if ($page != "") { $content = $ybd->fetch($ybd->$template_dir.'site/'.$page); if ($_int == '') { $ybd->assign('content', $content); } else { echo $content; return $content; } } then my html to call the link... <a href="index.php?pg=about" class="nav_links" onmouseover="bgchange('nav4');" onmouseout="bghide('nav4');" onclick="changeNav('index.php?pg=about'); return false;">About Us</a> the first part of the ajax works (in that it changes to my indicator.gif image. but it just gets stuck there.. dont see any errors myself.. when i throw an alert into the processNav i just get an alert of: [object Object] which ive never gotten before. Quote Link to comment Share on other sites More sharing options...
radar Posted August 7, 2010 Author Share Posted August 7, 2010 I got it figured out I guesss... Still don't know why my trim wasnt working... but basically my var responseTextTrim = trim(originalRequest.responseText); was failing, causing the responseTextTrim to be esentially nothing (so bad that not even an alert comes up for it).. so i change the next line to $('TransMsgDisplay').innerHTML = originalRequest.responseText; and it works correctly. so guess that's what i'm doing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.