There are no scripts, but the page is still loading.

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Posts: 2
Joined: April 24th, 2012, 11:28 am

Post Posted November 21st, 2015, 11:35 am

When running below code I keep getting subject error message. The JSON data returned by the php file is correct and the database is populated correctly.

I checked with JAVASCRIPT 'Lint' monitor and code is ok? Code follows.

Code: Select all
<!DOCTYPE html>


<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title> GPS Information from Garman GPSmap76CSx </title>

<!-- ============== styles  ================ -->

<link rel="stylesheet " type="text/css" href="css/gps.css" />

<!-- ============== scripts1 ================ -->

   <script  type="text/javascript" src="../jquery/jquery-1.9.1.js"></script>   

<script type="text/javascript">

[b]// Since I am getting out of memory error using the <form>
// creating var and calling AJAX directly to test php response.[/b]

$(document).ready(function () {

var file="waypoints.gpx";

}); // end ready


<!-- =============== html  ================== -->

<div class="wrapper">

[b]<!--   ignore for now - creates out of memory error[/b]
<div id="forms">

    <p>To Down load a Garman GPX file directly to 'mymapping' database file.</p>
    <p> <label for='gpxname'>Enter GPX File Name</label>
      <input type="button" style="width:170px" class='hov'  name='gpxname' id='gpxname'/><br>             


<div id="rbox" >


<!-- =============== scripts2 ================ -->

<script type="text/javascript">

[b]// ignore for now[/b]

$('#gpxname').change(function ()  {
   var filename=$('#gpxname').val();

    myAjaxCall(filename); });

<!-- ============  Function showTable  =================== -->
[b]<!--  ignore for now[/b]

<script type="text/javascript">

function showTable(data) {

alert("in showTable");



<script type="text/javascript">

<!-- ============  Function myAjaxCall  =================== -->

function myAjaxCall(file) {

var request = $.ajax({
    url: "error-downloadGpx.php",
    type: "GET",
    data: {"gpxfile":file},
    dataType: "json"       

request.done(showdata); jqXHR, textStatus ) {
  alert("Request failed, see firebug."); //document.write( "Request failed: " + textStatus );   

function showdata(data) {  [b]// shows correct data but page keeps loading???[/b]

$.each(data, function () {

   $.each(this, function (key, value) {
         document.write(value+", ");

}); // each


}); // each

} // show

}// myAjaxCall




User avatar
Posts: 11091
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted November 23rd, 2015, 6:28 pm

Try using document.close() after the last document.write().

Or better yet, don't use document.write() in an event handler. Instead you can build a string and then appendChild() into the relevant target destination.

Return to Web Development / Standards Evangelism

Who is online

Users browsing this forum: No registered users and 2 guests