I have page in which there's a function which calls a function from js file.
the code which calls function in js file:
<script language="javascript" type="text/javascript">
var qc = qc_chat;
window.onload = function()
{
qc.setup('<?php echo $p; ?>');
}
</script>
I am including qc.js file using this code:
function doThat() {
$.ajax({
url: 'http://www.example.com',
type: 'GET',
data: 'adrs='+getHost( document.domain ),
dataType: 'jsonp',
jsonp: false,
jsonpCallback: 'methodCallback',
success: function( data ) {
if( data.message == "yes" ) {
} else {
$.getScript("qc.js"); //files m including using this ajax
$.getScript("tools.js"); //files m including using this ajax
}
},
error: function( error ) {
console.log( error );
}
});
}
and i am calling doThat()
using <body onload="doThat();">
but i am getting the error in console Uncaught ReferenceError: qc_chat is not defined
Thanks