Page does not finish loading when using getJSON
Hello,
I am a beginner to jQuery and I am facing a odd problem. I have to retrieve some information via the getJSON method in jQuery from a php page. But everytime I open that page, my data is retrieved without any problems but the page is shown to be still connecting. Please see image-:
Also I am getting weird links when I right click on the back button-:
"wyciwyg://:http......"
Please see image-:
I thought AJAX requests where not suppose to load another page then there should be no such entry in my browsing history. I am using the latest version of WAMP server and my
html file is as follows-:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jsonDemo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js" ></script>
</head>
- <body>
<script type="text/javascript" >
$(document).ready(function(e) {
$.getJSON('http://localhost/checkCart.php',function(json){
document.write(json.data);
});
});
</script>
</body>
</html>
And my php file is as follows-:
- <?php
$a=array('data' => 'Hello World');
echo(json_encode($a));
?>
I am really frustrated with this problem. I mean my code is as simple as it gets. WHAT AM I DOING WRONG?? I am testing this on the latest version of Mozilla Firefox on Windows 8 Pro 64bit.
The output of my Web Console from Firebug in Firefox is as follows(check Image)-: