2

Why does my html page does not run into my javascript block? I add some alert lines and they dooesn't pop-up.. I try to make a ajax get call to load a table with sql data..

EDIT

I added the code to autoload it but that seems not to work.

Here is the code:

<ion-view style="" title="scorebord">
    <ion-content class="has-header" overflow-scroll="true" padding="true" style="background: url(img/EYC8SNR0QEuE8C0rKDBQ_menu3.png) no-repeat center;">
        <body onload="httpCall2()">
            <p>tip</p>

            <script type="text/javascript">

                function httpCall2() {
                    alert("datasdsd");
                    $.ajax({
                        type: 'GET',
                        url: 'scorebord_data.php',
                        contentType: "application/json; charset=utf-8",
                        data: {data: data},
                        dataType: "json",
                        complete: function (data) {
                            //alert(data);
                            //alert(JSON.stringify(data));

                            //alert(data.toString());
                            //alert(data[1]);
                            var array = data.responseJSON;
                            alert(array);
                        }
                    })
                }

                $(document).ready(function httpCall() {
                    alert("datasdsd");
                    $.ajax({
                        type: 'GET',
                        url: 'scorebord_data.php',
                        contentType: "application/json; charset=utf-8",
                        data: {data: data},
                        dataType: "json",
                        complete: function (data) {
                            //alert(data);
                            //alert(JSON.stringify(data));

                            //alert(data.toString());
                            //alert(data[1]);
                            var array = data.responseJSON;
                            alert(array);
                        }
                    })
                })

            </script>

        <at-pagination at-list="list" at-config="config"></at-pagination>
        </body>
    </ion-content>
</ion-view>
Funk Forty Niner
  • 73,764
  • 15
  • 63
  • 131
GNIUS
  • 145
  • 9
  • You haven't specified that your JavaScript should run AFTER the page has loaded. See: http://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load – devlin carnate Jan 07 '16 at 23:57
  • @devlincarnate I added code. I tried 2 solutions but it still doesn't work – GNIUS Jan 08 '16 at 00:07
  • 1
    Is jQuery loaded? Since you are using $(document).ready(), you need to load jQuery. Also, you could try $(window).ready(). – Quack Jan 08 '16 at 00:50
  • Check your browser console log for errors. F12 in most browsers. – devlin carnate Jan 08 '16 at 03:28

0 Answers0