Problems with calling a JS function
<p>I have a function which populates a div but includes js onclick. How ever its producing some weird error i've not seen before.</p>

<p>This is the function:</p>

<pre><code>//Browser Support Code for AJAX Requests
function ajaxFunction(url,data){
  if (window.XMLHttpRequest) {              
    AJAX=new XMLHttpRequest();              
  } else {                                  
    AJAX=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (AJAX) {
  querystring = "?dta="+data;
     AJAX.open("GET", url + querystring, false);                             
     AJAX.send(null);
     return AJAX.responseText;                                         
  } else {
     return false;
  }                                             
}       


function subpopulate(id,array,type){ alert('test2'); // alert to check if called
document.getElementById(id).innerHTML += "&lt;div class='subm'&gt;test&lt;/div&gt;";
}

function menu(type,scri,get){ alert('test'); //alert to check if called
        var result = ajaxFunction(scri,get);
        subpopulate('offset',result,type);
}

function loadmain(id){
document.getElementById(id).innerHTML = "&lt;table style='width:100%;'&gt;&lt;tr&gt;&lt;td&gt;&lt;a href='#' onclick='javascript:menu('build','build.php','false');'&gt;Build&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
}
</code></pre>

<p>When i click the link it doesn't call "menu" function it errors with this:</p>

<p>Uncaught SyntaxError: Unexpected token }</p>

<p>In console errors all I see is for its information is this below:</p>

<pre><code> window.script1332821403739=1;
</code></pre>

<p>Any ideas why this is happening :S ?</p>
