Hi all,
I have a problem in my mvc application. i have a xml file that have a xml data to display record on result view.
Problem is that when i call a getFlightData method of c# class from javascript function, but if response xml file have 40- 50 record then this script function get
json data very fast from getFlightData method of c# class but if response xml file have 200-300 record then script function get json data very slow 10-15 second from getFlightData method of c# class. this problem is happen when application run on server.
plz suggest me how i can perform this task in fast way. Thanks in advance
Result.chtml file.
<script>
$.ajax({
type: 'POST', // POST GET
dataType: 'json',
url: '/Result/getFlightData',
data: { id: '67', name: 'Deepak' },
success: function (Data)
{
create_resultList(Data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// error code
}
});
</script>
ResultController.cs file
public string getFlightData(string id, string name)
{
filePath = Server.MapPath(@"~\App_Data\Result\SF" + Session.SessionID + ".xml"); // dynamic
filePath = System.IO.File.ReadAllText(filePath);
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(filePath);
return JsonConvert.SerializeObject(xdoc);
}