0

I am posting data to an Action, get json data as a result, and then, process the result in javascript.

It's work well on dev server, but when i publish it on Azure WebApp, when I post my data, it display the json on the screen.

The begining of my Form to post data :

@using (Ajax.BeginForm("UpdateAccount", "Loging",
new AjaxOptions
{
    HttpMethod = "POST",
    OnSuccess = "processAccountUpdateResult"
}))
{

Note: processAccountUpdateResult is the javascript function which process the json result.

Here is my action :

[HttpPost]
public ActionResult UpdateAccount(string newName)
{
    return Json(new { result = "ok" }, "text/html", JsonRequestBehavior.AllowGet);
}

Note : I added the "text/html" mime type after I read this But no luck. I tried to add the json mimetype in the web.config, but still no luck :

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json"/>
    </staticContent>
  </system.webServer>
</configuration>

Thanks

Community
  • 1
  • 1
Matthieu Charbonnier
  • 2,794
  • 25
  • 33

1 Answers1

0

To make it working, we need to add this to the web.config :

<add key="UnobtrusiveJavaScriptEnabled" value="true" />
Matthieu Charbonnier
  • 2,794
  • 25
  • 33