Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2011, 02:09 PM   PM User | #1
Tidus
New Coder

 
Join Date: Aug 2002
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
Tidus is an unknown quantity at this point
Issue with JS loading on ajax loaded tabs.

Hi everyone,

So I am completely new to ajax (and not that familiar with JS) and I am struggling a bit trying to implement "tabs" into my project.

I am using the tabs found here (http://www.dynamicdrive.com/dynamici...tabcontent.htm) with pages loaded through ajax.

the issue I am having is that after the initial load of all the tab content, it seems that any javascript i have in any pages accessed through links (and loaded in the active tab) doesn't seem to be running. the main problem is having a tab with a form in it, and i am trying to submit the form using ajax and then load a confirmation page. i am aware i could be doing this the complete newb way, but being a newb this is a given hehe.

the script i am using to power the tabs is here;

Code:
<script type="text/javascript">
function ahah(url, target) {
  document.getElementById(target).innerHTML = ' Fetching data...';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
	ahah(name,div);
	return false;
}</script>
does anybody have any suggestions?

thanks heaps!
Tidus is offline   Reply With Quote
Old 01-17-2011, 03:13 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Despite the similar sounding names, Java is not the same as Javascript.
Moving from Java forum to Javascript > AJAX forum.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 01-31-2011, 12:43 AM   PM User | #3
Tidus
New Coder

 
Join Date: Aug 2002
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
Tidus is an unknown quantity at this point
bump..
Tidus is offline   Reply With Quote
Old 01-31-2011, 01:46 AM   PM User | #4
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
This might help you:
http://zeta-puppis.com/2006/03/07/ja...l-the-revenge/

Generally speaking, using Javascript to fetch HTML containing Javascript and making it execute is not a trivial task.
venegal is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:27 AM.


Advertisement
Log in to turn off these ads.