I have page A that issues an ajax call and brings in snipped B. This snippet is being added into the DOM and all the scripts in that snipper are eval-ed. In that snippet, I have 2 script tags as such:
<script type="text/javascript">
function doOptions(){
alert('doOptions');
}
</script>
<script type="text/javascript">
X = {
x : function(x) {
alert('x');
}
}
</script>
Then the JS that is declared in the above script tags is being used on within snippet B as such:
<button type="button" onclick="doOptions();"> options </button>
<button type="button" onclick="X.x();"> XX </button>
Clicking on the XX button work, but clicking on the options button, does not. Both firefox and IE tell me that doOptions is not defined. Why?
Also, what category of Javascript knowledge is this? Meaning, if I want to read more about this, what do I search for, where do I look in the table of contents in a JS book?
Thanks.