0

我对黑莓网络非常陌生。当我向接受两个值的 Asp.net 网络服务编写 jQuery ajax 请求时。它返回错误错误请求。我正在为 Chrome 插件使用波纹进行测试。代码是

  jQuery.support.cors = true;
$.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: "http://xyz.in/webservice.asmx/backup_p",
    data: "{ 'id': '1', 'data': '4' }",

    dataType: "json",
    success: function (msg) {
        alert('sucess !!!');
        alert(msg.d);


    },
    error: function (jqXHR, textStatus, errorThrown) {
        alert('hello');

        alert(jqXHR + " : " + textStatus + " : " + errorThrown);
    }
});

我尝试了很多方法,但没有任何解决方案。跟涟漪有关系吗?

4

1 回答 1

1

您的 json 无效,应该是{ "id": "1", "data": "4" },请注意键和字符串引号如何"代替'.
也不要手动构建 ajax,而是使用 JSON.stringify。例如

data: JSON.stringify({ 'id': '1', 'data': '4' }),
于 2013-06-10T03:43:38.800 回答