想弄清为什么这种“优质联合材料”在呼吁执行时发出“雅克斯”呼吁。
I have this button to make an ajax GET request to a method in the controller, the method will partial render. When I click on the button I don t see any request coming on the console but I see the alert "test" on the browser.
I have the same exact JS with other parameters working for other tupes of ajax calls, so I just copied one of them and changed all required parameters, expecting it shall work right away. Neither I get any errors on the console. My routes and id names are good and verified. What is it that I am missing here?
意见-说明:本纽特通过另一旁系提供,该部分工程使用。
<%= button_tag "Add / Remove", :id => "add_remove_button", :onclick => "javascript:add_remove();" %> #note: this is buried under div tags in a html table
JS-
function add_remove(){
$( #add_remove_button ).click(function() {
$.ajax({
type: GET ,
url: "/item/add_remove",
success:$( #view_item ).html(data)
/*function(){ },
data:$( #test ).serialize(),
error: function(){ },
success: function(data){ },
complete: function (){ }*/
}); #No ajax call made
/*return false;*/
});
alert( test ); #I get this alert
}