Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.net 3.5 WebMethod Strange Behavior, jQuery AJAX receives strange data
    primarykey
    data
    text
    <p>I've ran into this strange JSON behavior.. I just cant figure out what the hell is going on..</p> <p>I've got a WebMethod in my asp.net page.. It repetitively calls as page loads through jQuery AJAX.. Everything goes pretty smooth but what strange thing happens is that the data I sens to my jQuery ajax is not the SAME I just sent.. :S </p> <p>here is not code of page method </p> <pre><code>[WebMethod()] public static List&lt;Unister.UnisterCore.Core.Domain.Comment&gt; LoadComments(long objID, int sysID) { if (objID == 0) return null; UnisterWeb.UserControls.Presenter.CommentsPresenter _presneter; _presneter = new UnisterWeb.UserControls.Presenter.CommentsPresenter(); List&lt;Unister.UnisterCore.Core.Domain.Comment&gt; comments = new List&lt;Unister.UnisterCore.Core.Domain.Comment&gt;(); comments = _presneter.LoadComments(sysID, objID); if (comments.Count == 0) return null; return comments; } </code></pre> <p>Here returning list is what I got from my presenter layer but when I receive that in my js method, its either null or previous value.</p> <p>Here is my jQuery method..</p> <pre><code>function LoadComments(SysID, ObjID) { if (parseInt(SysID) == 0 || parseInt(ObjID) == 0) return; var args = 'objID:' + ObjID + ',sysID:' + SysID; $.ajax({ type: "POST", url: "/dashboard/default.aspx/LoadComments", cache: false, data: '{' + args + '}', contentType: "application/json", dataType: "json", success: function(result) { if (result.d != null) { comments = new Array(); $.each(result.d, function(key, val) { data = new Object(); data.CommentID = val.CommentID; data.Body = val.Body; codate = new Date(parseInt(val.CreateDate.replace("/Date(", "").replace(")/", ""), 10)); var fdate = dateFormat(codate, "isoUtcDateTime"); ldate = $.timeago(fdate); data.CreateDate = ldate; data.CommentByAccountID = val.CommentByAccountID; comments.push(data); }); var boxid = "#commentBox_" + ObjID; $(boxid).setTemplateURL("../Templates/comments.htm"); $(boxid).processTemplate(comments); } } }); </code></pre> <p>}</p> <p>Please help me..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload