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?
This isn't a duplicate to what was linked. This is asking how to use a variable for the success function when updating a DOM element. I have 1, possibly N tables of data, each table can call this POST function, and I need it to update the table that called it.
This works just fine. Spelling helps a ton when you are referencing DOM elements.
 
    