Chinese Character Issue in AJAX with C# & Jquery -
i getting ajax error chinese character can share fix?
error
jquery
var jqxhr = $.post("handler1.ashx", function () { alert("success"); }).fail(function (data) { alert("error"); });
c#
public void processrequest(httpcontext context) { var ticketresponse = new ticketresponse(); ticketresponse.addedcount = 23; // tickets available , added cart ticketresponse.success = true; ticketresponse.successitems = new list<successfullitem> { new successfullitem() { orderitemid = 1, title = "【桃姐與我】舞台劇(粵語)粵語)" } }; var output = serializer.serialize(ticketresponse); context.response.addheader("content-type", "application/json"); context.response.addheader("content-length", output.length.tostring()); context.response.addheader("content-disposition", "inline"); context.response.addheader("content-transfer-encoding", "text"); context.response.write(output); context.response.flush(); context.applicationinstance.completerequest(); }
i found solution .... not working generic handler works fine webservice without problem.
[webmethod] [scriptmethod(usehttpget = false, responseformat = responseformat.json)] public handler1.ticketresponse helloworld() { var ticketresponse = new handler1.ticketresponse(); ticketresponse.addedcount = 23; // tickets available , added cart ticketresponse.success = true; ticketresponse.successitems = new list<handler1.successfullitem> { new handler1.successfullitem() { orderitemid = 1, title = "【桃姐與我】舞台劇(粵語)粵語)" } }; return ticketresponse; }
Comments
Post a Comment