javascript - empty() and then append() gives a blinking effect -
After
I have this code
$ .ajax ({type: "post", url : "Display.aspx / getSchedules", data: '{"_facilityID": "' + facilityID + '", "_facilityTime": "' + m + '", "_facilityOffset": "' + + OS +" "_facilityClock ":" + FacilityClock + '"," _FacilityDisplayPastEvents ":"' + FeatureDisplayPastEvents + '' ', contentType: "application / json; charset = utf-8", datatype: "json", success: function {$ ("# MySchedule") empty () enclosed (data.d); ..}, error: function (data) {toastr.error ("error in getSchedules");}});
< / Pre>Actually, I'm fetching data from the server and then reloading the table Re-structuring in the webmath since I am using the empty () function and then adding markup to the table, reproducing that table, whatever is highlighted in that table , It becomes empty for the other, and then highlights back.
Is there a better way to do this? Thanks
Anyone interested in WebMethod, here is:
[WebMethod] public static string getSchedules (string _facilityID DATETIME, _facilityTime, string _facilityOffset, string _facilityClock , Bool _FacilityDisplayPastEvents) {If (_facilityID == string.Empty) Return string Empty; If (_facilityTime == faucet) return string. Empty; Uses (Livein5Entities Reference = New Livein5Entities ()) // Uses / db closes and manages us for {int facilityID = Convert.ToInt16 (_facilityID); Var feature = context.activity. Where (u = & gt; u.filithID == feature id & amp; amp; u.active == true) .FirstOrDefault (); Var feature_space = reference.place Where (u = & gt; u.locationID == feature. Place id). FirstOver Default (); Datatelle schedules = received alkaliscids (_facilidi, _facilitime, _facityoffset, _filitidisplaypeltevents); Var scheduleHTML = "& lt; Table class = 'Schedulable' & gt;"; Var index = 1; Foreign currency (DataRow items in Schedules.Rows) {DateTime startTime = DateTime.Parse (item [2] .ostring ()); Date timeout time = date time.ps (item [3]. Ostring ()); StartTime = startTime.AddHours (-8); Endtime = endtime.ADHORS (-8); Schedule html + = "& lt; tr id = 'fsid id_" + index + "' class = 'schedule adam' & gt;"; Schedule HTML + = "& lt; td class = 'time' & gt;"; If (_facilityClock == "24") // Check that the user has selected 24 hours or 12 hours or not. {Schedule HTML + = "Lt; div class = 'Beginner Time' & gt; + StartTime.ToString ("HH: mm") + ""; Schedule HTML + = "& lt; div class = 'end time' & gt;" + Endime Toastring ("HH: mm") + ""; } And {Schedule HTML + = "& lt; div class = 'Beginning' & gt;" + StartTime.ToString ("H: mm TT") + "& lt; / div & gt;"; Schedule HTML + = "& lt; div class = 'end time' & gt;" + Endtime.ToString ("h: mm tt") + ""; } Schedule HTML + = "& lt; / td>"; Schedule HTML + = "& lt; td class = 'guest' & gt;"; Schedule HTML + = "& lt; div class = 'GuestName' & gt; + Object [4]. Ostring () + "& lt; / div & gt;"; Schedule HTML + = "& lt; div class = 'topic' & gt; + Object [5]. Ostring () + "& lt; / div & gt;"; Schedule HTML + = "& lt; / td>"; Schedule HTML + = "& lt; td class = 'EventDetails' & gt;"; Schedule HTML + = "& lt; div class = 'EventName' & gt; + Item [6]. Ostring () + ""; Schedule HTML + = "& lt; div class = 'host' & gt;" + Object [7]. Ostring () + "& lt; / div & gt;"; Schedule HTML + = "& lt; / td>"; Schedule HTML + = "& lt; / tr & gt;"; Index ++; // ID Increasing - Index} Schedule HTML + = "& lt; / table & gt;"; Return schedule html; }
Comments
Post a Comment