$.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调用。任何人都可以帮助我吗?
答案 0 :(得分:0)
尝试:
data: {sortedText:"sortedText"},
而不是
data: "sortedText",
并使用:
dataType: 'json'
而不是
datatype: 'json',
答案 1 :(得分: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");
}
});