I think you are trying to pass the value of the title attribute in your AJAX request. If so, the easiest way to do this is in one event handler (is there a reason why you are linking 2 different handlers to the same event?):
$("a.false").click(function(e) { $(this).closest("tr.hide").hide("slow"); var main_id = this.title; var display = "false"; e.preventDefault(); $.ajax({ url: "/useradminpage", data: {main_id: main_id, display: display}, success: function(data) { display_false(); alert("4 - returned"); } }); });
Currently, the problem is that main_id and display not in the scope of the second event listener, so it will be undefined (and they should not be specified, otherwise you just pass the lines), since you are passing the data object to the ajax function, you really don't need to add URL query string.
Also, when you assign the value to main_id , you use a.title . In this case, a is undefined, and you will need to use this , which will be a link to the clicked item.
source share