Ajax调用无法在mozilla中运行

时间:2010-09-21 06:04:07

标签: jquery ajax asp.net-mvc-2

我的代码在除mozilla firefox之外的所有浏览器中都运行良好

$(document).ready(function () {
            var id1 = '<%=ViewData["UserName"]%>';
            var id2 = '<%=ViewData["UsrProfile"]%>';
            var msg = $('#addFrnd').attr('value');
            $.ajax(
              {
                  type: "POST",
                  url: "/Profile/SendFriendRequest",
                  data: "id=" + id1 + "&id1=" + id2 + "&message=" + msg,
                  success: function (result) {
                      $('#addLineItemControlSection').jqmHide();
                  },
                  error: function (req, status, error) {
                      alert("Make sure that javascript is enabled on your browser");
                  }
              });
        });

1 个答案:

答案 0 :(得分:2)

$(document).ready(function () {
            var id1 = '<%=ViewData["UserName"]%>';
            var id2 = '<%=ViewData["UsrProfile"]%>';
            var msg = $('#addFrnd').attr('value');
            $.ajax(
              {
                  type: "POST",
                  url: "/Profile/SendFriendRequest",
                  data: {'id': id1 , 'id1': id2,'message':msg},
                  success: function (result) {
                      $('#addLineItemControlSection').jqmHide();
                  },
                  error: function (req, status, error) {
                      alert("Make sure that javascript is enabled on your browser");
                  }
              });
        });

data: "id=" + id1 + "&id1=" + id2 + "&message=" + msg,

data: {'id': id1 , 'id1': id2,'message':msg},