I am using below code to my project its working fine. but some times i am loading same page four or five times the data will not return it will shows readystate 0 or undefined and am use this code in same domain not cross domain but i cant get exact error. please tell me if any one solved before this error
Html page .
$(document).ready(function () {
first();
});
function first() {
var firstajaxcall = null;
firstajaxcall = $.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "webservice/ws_home.asmx/load_lender_list",
data: "{}",
dataType: "json",
success: function (setvalue) {
},
failure: function () {
},
error: function (response) {
alert("error" + response.d);
}
});
}
<big>Webservice file</big>
[WebMethod]
public borrowercls[] load_borrower_list()
{
string query = string.Empty;
con.mycon();
List<borrowercls> lt_brlist = new List<borrowercls>();
query = "select bloan.borrower_id, bloan.bor_purpose, bloan.bor_amount, bloan.interest, bloan.loan_duration from borrower_required_loan_details bloan, borrower_pdetails bpdetails where bpdetails.profile_agreed='1' and bloan.borrower_id = bpdetails.borrower_id";
DataTable dt = dtdal.dt_return(query);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
borrowercls hlist = new borrowercls();
hlist.brid = dr["borrower_id"].ToString();
hlist.br_amount = dr["bor_amount"].ToString();
hlist.br_purpose = dr["bor_purpose"].ToString();
hlist.br_interest = dr["interest"].ToString();
hlist.br_duration = dr["loan_duration"].ToString();
hlist.error = "true";
lt_brlist.Add(hlist);
}
}
else
{
borrowercls hlist = new borrowercls();
hlist.error = "false";
lt_brlist.Add(hlist);
}
return lt_brlist.ToArray();
}
public class borrowercls
{
public string brid { get; set; }
public string br_amount { get; set; }
public string br_interest { get; set; }
public string br_month { get; set; }
public string br_purpose { get; set; }
public string br_duration { get; set; }
public string error { get; set; }
public string err_msg { get; set; }
}