Hi I have been going through this article: asp.net jquery ajax json: Simple example of exchanging data
I am also using same code problem that is I am able to pass values to my handler and when i see values in handler using breakpoint everything is working fine but I am not getting values returned by handler My javascript code is:
<script type="text/javascript">
jQuery("#<%=btnsubmit.ClientID %>").click(function () {
var myData = { "hicode": $('#textbox1 ').val() };
$.ajax({
url: "HandlerHinditoEnglish.ashx",
data: myData,
type: 'POST',
success: function (data) {
$("#textbox2").val(data);
},
error: function (data, status, jqXHR) { alert("FAILED:" + status); }
});
});
and handler code is
HttpResponse r = context.Response;
r.ContentType = "text/plain";
string Hinditext = string.Empty;
string Englishtext = string.Empty;
string myPar = context.Request.Form["hicode"];
Hinditext = myPar;
Englishtext = hcnvrt.ToEnglish(Hinditext).ToString();
context.Response.Write(Englishtext);
I want to do is if i enter some text in textbox1
, textbox2
should get filled with the same value.