javascript - Unique jQuery function to update data from any table -
i have jquery function on separate functions.js file, in charge of making sql update posting info. working properly, here can see it:
function being called on php file, passing element's id info:
$('.tablecontent').on('click', '.discontinueicon', function() {  turnid = $(this).attr('data-id');  discontinuerow();})   function working on separate functions.js file:
function discontinuerow(){     row = '#' + turnid;     $.post('config/forms/turn_conf/turn_discontinue.php', { tu_id:turnid }).success(messageokkkk);}   as need create many more functions updating info many tables, trying have unique function, , provide needed info being sent parameters php files. new this, not know if possible, , if can't way to.
i tried store needed values on several variables on php file:
$('.tablecontent').on('click', '.discontinueicon', function() {    turnid = $(this).attr('data-id');    action = "'config/forms/turn_conf/turn_discontinue.php'";    elements = "tu_id:turnid";    discontinuerow(action,elements);})   and using these parameters on separate functions.js file shows:
function discontinuerow(action,elements){     row = '#' + turnid;     $.post(+action+,{ +elements+ }).success(messageokkkk);}   but not work. possible pass way parameters function? in case, going wrong here?
you can this:
$('.tablecontent').on('click', '.discontinueicon', function() {  turnid = $(this).attr('data-id');  discontinuerow('config/forms/turn_conf/turn_discontinue.php', { tu_id:turnid }); });   you need set function input parameters:
function discontinuerow(url, params){     row = '#' + turnid;     $.post(url, params).success(messageokkkk);} }      
Comments
Post a Comment