Pass javascript variable to AJAX success function
I have a page with 1-N tables of courses, and I'm trying to get my ajax
function to update the table that called it, and not every table, or just
one.
$(document).on('click',".addCourse",function(e){
var courseTable = $('#courseList1');
HideDialog();
$.ajax({
type:'POST',
data:'{}',
url:'/degreebuilder/degree/createCourse',
success:function(data,textStatus,courseTable){
$(courseTable).html(data);
},
error:function(XMLHttpRequest,textStatus,errorThrown){}
});
});
How do I pass the success function the var courseTable?
Here is the full code block with a hardcoded id, and it doesn't work.
No comments:
Post a Comment