I have a partialview for my table, I want that every time the dropdown is changed the table will refresh acording to the dataset record. But having an error of
- Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http:
It appears when I added this script:
- $("#txtCategory").change(function () {
- var value = (this).value
- $("#tblAssessment").load('@Url.Action("getcategory", "assessment")/' + value);
-
- });
In my controller assessment:
- public ActionResult GetCategory(string ID)
- {
- dynamic model = new ExpandoObject();
- var serviceentry = new wmssoft_srm.Models.ServiceEntryFields();
- model = serviceentry;
-
- #region "getqacategory"
- model.GetQA = GetQACategory(ID);
- #endregion
-
- return View("_assessment", model);
- }
-
- private List<wmssoft_srm.Models.ServiceQACategory> GetQACategory(string category = "")
- {
- WMSSOFT_WCF_Service.WMSSOFT_InterfaceClient wmsSR = new WMSSOFT_WCF_Service.WMSSOFT_InterfaceClient();
- DataSet dsl = new DataSet();
- DataSet dsO = new DataSet();
- string a = "ValidateCredentials";
- string b = category.ToString() + "~~";
-
-
- b = wmsSR.fCallWMSSOFTService("GetSRMQuestionsByCategory", b, ref dsl, ref dsO);
-
- if (b == "OK ~~")
- {
- if (dsO.Tables[0].Rows.Count >= 0)
- {
- DataTable oDT = new DataTable();
- oDT = dsO.Tables[0];
-
- wmssoft_srm.Models.ServiceEntry slData = new Models.ServiceEntry();
- var myList = slData.GetQACategory(oDT);
-
- return myList;
- }
- }
- return null;
- }
-
- }
And for my Model:
- public List<ServiceQACategory> GetQACategory(DataTable oDT)
- {
- List<ServiceQACategory> slData = new List<ServiceQACategory>();
- for (int i = 0; i < oDT.Rows.Count; i++)
- {
- ServiceQACategory sl = new ServiceQACategory();
-
- sl.questionId = Convert.ToInt32(oDT.Rows[i]["QID"].ToString().Trim());
- sl.question = oDT.Rows[i]["QUESTION"].ToString().Trim();
-
- slData.Add(sl);
- }
-
- return slData;
- }
-
- }
-
- public class ServiceQACategory
- {
- public int questionId { get; set; }
- public string question { get; set; }
- }
Thanks