i want the document.ready
function should called after the my ajax
gets success.
In jsondatachart.js
script i used one ajax method, in which i get the data from excel sheet and stored in window.ChartData
as below. All my data from excel gets stored in window.ChartData but this is happening after document.ready() function is called.
// "jsondatachart.js" script
$.ajax({
type: "GET",
url: "Data.csv",
dataType: "text",
success: function(data) {window.chartData=data;}
});
In html
page i have referred that script jsondatachart.js
, the script gets loaded and the debugger gets hit in $.ajax. But the success function gets fire only after the document.ready function is executed. so the window.ChartData
used in the main page is showing undefined
I am facing this problem in IE
browser, in firefox
its working fine.
<html>
<head>
<script src="Scripts/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.globalize.min.js" type="text/javascript"></script>
<script src="Scripts/jsondatachart.js" type="text/javascript"></script>
</head>
<body>
<div id="container"> </div>
<script type="text/javascript" language="javascript">
$(function () {
// var data=window.ChartData; (showing window.ChartData is undefine)
});
In simple,
I want the $(function(){})
should called only after the success function in ajax is fired, so that i can make use of the window.ChartData
in my document.ready()
function.
Thanks in advance