<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
<b>Want to improve this post?</b> Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
</div>
</div>
</div>
</div>
</aside>
I have used $.post
before, now trying $.ajax
, here is the code. I don't know why it aint working.
I don't to know how to debug this thing as well, whenever I run this. I get error alert box
$.ajax({
type: 'POST',
url: 'Handler1.ashx',
data: { formula: "formulaId" },
error: function (result) {
alert('error');
},
success: function (result) {
alert('success');
}
});
Handler1.ashx in the same folder
namespace RegistrationHTML.HTML
{
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
Console.Out.WriteLine("hi");
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
Console.Out.WriteLine("hi");
}
public bool IsReusable
{
get
{
return false;
}
}
}
</div>
Try specify the dataType
:
$.ajax({
type: 'POST',
url: 'Handler1.ashx',
data: { formula: "formulaId" },
dataType: 'html', // or 'text'
error: function (result) {
alert('error');
},
success: function (result) {
alert('success');
}
});