November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
First:
Change this_:
$.ajax({ url: '/BreadcrumbAndSharing/SendEmail/', type: 'GET'
To
$.ajax({ url: '/BreadcrumbAndSharing/SendEmail/', type: 'POST'
And then decorate your action with this
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SendEmail(Person person)
{
Thanks, i did tried these options as already. Code shared is for GET request, whcih is working POST is not working at all. if you track it in fiddler it says HTTPS status code 301 got POST and then after that it issue a GET request automatically which says 404, (which is obvious i think becuase action is decorated with POST attribute)
I am trying to send an ajax POST request from javascript (razor view ) to epi server block controller, it is not hitting. I am only to able to send GET request. Below is the code snippet for controller for javascript
$.ajax({ url: '/BreadcrumbAndSharing/SendEmail/', type: 'GET', data: JSON.stringify({ name: "Tommy", birthday: new Date(1921, 0, 1), hobbies: ["Pinball", "Holiday camp"] }), contentType: 'application/json', error: function (xhr) { alert('Error: ' + xhr.statusText); }, success: function (result) { CheckIfInvoiceFound(result); }, async: true, processData: false });
public ActionResult SendEmail(Person person)
(Request.Params[0].ToString());
{
Object obj = JsonConvert.DeserializeObject(Request.Params[0].ToString());
Person objperson = JsonConvert.DeserializeObject
string subject = "test email";
string body = "testing this email";
}
Any help is higly appreciated in this regard