0
$.ajax({
    type: "Get",
    contentType: "application/json",
    data: { sorted_ids: sortedId, sorted_row_ids: sortedRowId,
                                  sorted_col_ids: sortedColId},
    url: "/inventory/drag",
    dataType: "json",
    success: function(data) {
         alert("sucess");
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
         alert("unsucessful");
    }

});

<%= button_to "save","#",:title => "save",:id => "save_button" %>

当我单击按钮时,我会收到警报,但没有触发 ajax 调用。谁能帮我?

4

2 回答 2

0

按以下方式使用 ajax 调用:-

$.ajax({
    type: "Post",
    contentType: "application/json",
    data: "{'name':'xyz'}",
    url: "abc.aspx",
    dataType: "json",
    success: function(data) {
         alert("sucess");
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
         alert("unsucessful");
    }

});
于 2013-08-21T08:13:27.137 回答
0

尝试:

 data: {sortedText:"sortedText"},

代替

 data: "sortedText",

并使用:

dataType: 'json'

代替

datatype: 'json',
于 2013-08-21T07:12:22.500 回答