$.get("CallBack.aspx", { nm: StateTx, nm2: StateTx2 }, function(data) {
$.each(data, function() {
$('[id$=DropDown1]').append("<option value=" + this['I3D'] + ">" + this['prmv'] + "</option>");
});
});
my problem ie8 last item undefined. how do fix ?
Amain cm2 = new Amain();
DataTable dt = cm2.Getdt(str, str3);
StringBuilder sb = new StringBuilder();
sb.Append("[");
foreach (DataRow item in dt.Rows)
{
sb.Append("{");
sb.Append("\"prmv\":\"");
sb.Append(item[0].ToString());
sb.Append("\"" + "},");
}
sb.Append("]");
Context.Response.ContentType = "application/json";
Context.Response.ContentEncoding = Encoding.UTF8;
Context.Response.Write(sb.ToString());
Context.Response.End();
This can happen because of the way IE handles Javascript arrays. In IE,
has five elements, the last of which is undefined. In Firefox, the last comma is ignored so the list has four elements.
Have a look at the exact data your
Callback.aspxis returning.Update: Your callback code causes this problem on the line:
This will produce an array like:
There is an extra comma before the
]of the returned array. One way to fix this might be to:This fix will work for both IE and Firefox (and all other browsers).