Search code examples
javascriptphpjquerycanvasjs

Javascript doesn't work after call a function


I'm using jqwidgets for windows popout and canvasJS for charts

$(document).ready(function () {
    $("#jqxwindow1 ").jqxWindow({ height:600, width: 1600, maxWidth: 1600, theme: 'fresh',autoOpen:false  });
});

This is the window and i make a chart which on click on label will call a java script function:

function onClick2(e) {
    //$('#test').load(document.URL +  ' #test');
    $(document).ready(function () { /// Wait till page is loaded
        $('#main'+e.dataSeries.testcase).load('index.php?proiect=' + '<?php echo $project; ?>', function () {
            /// can add another function here
        });

    }); //// End of Wait till page is loaded
}

When i click on label, my main div will got the results but after that my 'show/hide' window or click on chart doesn't work anymore.

Any suggestion ? Thanks!


Solution

  • Remove $document.ready inside onClick2().

    function onClick2(e) {
        //$('#test').load(document.URL +  ' #test');                       
        $('#main' + e.dataSeries.testcase).load('index.php?proiect=' + '<?php echo $project; ?>', function () {
        /// can add another function here
        });
    }