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

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

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

Post by pizzipie »

Hi,
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>

<html>

<head>
<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>	

<body>
<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";

myAjaxCall(file);
	
}); // end ready

</script>


<!-- =============== 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> 			    
    </p>

    
</div> 
 --> 
 
</div>

<div id="rbox" >


</div>

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

<script type="text/javascript"> 

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

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

 	myAjaxCall(filename); });
*/				
</script>

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

<script type="text/javascript">

function showTable(data) {

alert("in showTable");


}

</script> 
-->

<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); 

request.fail(function( 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

document.write("<br><br>");

}); // each

} // show

}// myAjaxCall

</script>

</body>
</html>
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

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

Post by jscher2000 »

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.
Post Reply