jQuery的阿贾克斯在IE,Chrome和FF工作...但不是Safari浏览器(使用MVC 4服务器) [英] jQuery ajax working in IE, Chrome, and FF...but not Safari (server using MVC 4)

查看:219
本文介绍了jQuery的阿贾克斯在IE,Chrome和FF工作...但不是Safari浏览器(使用MVC 4服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个接收数​​据并返回一个JSON字符串返回给客户端的MVC 4应用程序。在code完美的作品在Chrome,火狐和IE(只针对8 + ...但我其实已经看到它在IE7中工作)。这不,但是,在Windows上的Safari 5.x的工作(我没有一台Mac ...所以我不能测试)。

I have an MVC 4 application that is receiving data and returning a Json string back to the client. The code works flawlessly in Chrome, Firefox, and IE (only targeting 8+...but I have actually seen it work in IE7). It doesn't, however, work in Safari 5.x on Windows (I don't have a Mac...so I can't test that).

下面是jQuery的...(使用1.9.1 ... THX添乙詹姆斯问...忘了提到它更早)

Here's the jQuery...(using 1.9.1...thx Tim B James for asking...forgot to mention it earlier)

$.ajax({
        type: 'POST',
        url: '@Url.Content("~/Request/ValidateApprover/")',
        data: { 'name': input },
        success: function (json) {
          //do some work here
        },
        error: function () {
          //tell the user that it failed here
        }
      });

这是我的控制器,这是获得所谓的...

And here's my Controller that is getting called...

[HttpPost]
public ActionResult ValidateApprover()
{
  string emailAddress = "";
  string name = this.Request.Form["name"]; //<--the form is blank using Safari 5

  if (String.IsNullOrEmpty(name) || String.IsNullOrWhiteSpace(name))
    return Json(new { result = "blank" }, "application/json", JsonRequestBehavior.AllowGet);

  //...keep going if you got a value other than blank

当我用读我的控制器结果 this.Request.From [名称] ,我使用的是Firefox,Chrome和IE浏览器时,我很好。 ..但我使用Safari得到一个空白表单值。

When I try to read the results in my Controller using this.Request.From["name"], I am fine when using Firefox, Chrome, and IE...but I get a blank form value using Safari.

编辑1:我写了一个很简单的PHP页面来检查,看看数据是否被在Safari正常通过。看来,这是...所以它看起来像是在IIS之间和Safari是问题。

EDIT 1: I wrote a VERY simple PHP page to check and see if the data is being passed properly in Safari. It appears that it is...so it looks like something in between IIS and Safari is the issue.

编辑2:我写了一个很简单的MVC应用程序测试和数据在该测试....这使我相信这是某种形式的Safari浏览器中的HTML验证的东西横跨到来。我在此编辑也删除了发布请求头数据。

EDIT 2: I wrote a very simple MVC Application to test and the data is coming across in that test....which leads me to believe it's some sort of HTML validation thing in Safari. I also removed the posted request header data in this edit.

任何额外的想法?

推荐答案

问题是与Safari处理Kerberos身份验证的,但我已经找到了解决方案。

The problem is with Safari's handling of Kerberos authentication, but I have found a solution.

http://forums.iis.net/t/1182376.aspx/1

在IIS该线程描述协商(即的Kerberos )身份验证在Safari处理不当。你必须禁用协商作为提供者。

That thread on IIS describes that Negotiate (i.e. Kerberos) authentication is handled improperly in Safari. You have to disable Negotiate as a provider.

在IIS(我使用IIS 7.5),点击你的网站,那么验证(双击)→ Windows身份验证(一次点击)→提供商(右侧)→删除协商,并留下NTLM

In IIS (I am using IIS 7.5), click your site, then Authentication(double click) → Windows Authentication(single click) → Providers(on the right side) → Remove Negotiate and leave NTLM

这固定我的所有问题的Safari。

This fixed all my problems with Safari.

这篇关于jQuery的阿贾克斯在IE,Chrome和FF工作...但不是Safari浏览器(使用MVC 4服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆