CORS在IE中工作但在Firefox或Chrome中没有

时间:2014-04-09 18:57:02

标签: jquery ajax

我做了一个Web服务,现在我从不同的服务器上使用它。它在IE中工作正常,但是如果我在Firefox或Chrome中尝试它,我总会得到同样的错误: 500内部服务器错误

这是我的AJAX代码: $ .support.cors = true;

        $.ajax({
            crossDomain: true,

            type: "POST",
            url: "http://localhost:52350/CSJMSGovernWebServiceDMZ.asmx/GetStreets",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: "{'streetname':'" + value + "', 'streetno':'', 'orderby':''}"
        })
        .then( function ( response ) {
            $.each( response, function ( i, val ) {
                $.each(val, function( key, value ) {
                    var valor = value.Shortdescription;
                    html += "<li><a href='#'>" + valor + "</a></li>";
                });
            });
            $ul.html( html );
            $ul.listview( "refresh" );
            $ul.trigger( "updatelayout");
        });

当然,我在我的服务器上写了这个:

    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="content-type" />

欢迎任何建议。 非常感谢!

0 个答案:

没有答案
相关问题