tazphoenix
tazphoenix

Reputation: 194

write jquery plugin

i wrote a jquery function and now i want to use it as a plugin so i could use that more than 1 place.the code lookes like this:

    function loadTable(){
    $.post("includes/action.php", {action: "gettable"}, function(html){
        $("#tblstudents tbody").html(html);
        $("#tblstudents")
            .tablesorter({widthFixed: false, widgets: ['zebra'], sortList: [[0,0]]})
            .tablesorterPager({container: $("#pager")})
            .tablesorterFilter({filterContainer: $("#filter-box"), filterClearContainer: $("#filter-clear-button")});
    });
}

And I want it have functions for setting "includes/action.php" and "gettable" in $.post function and $("#pager") ,$("#filter-box") and $("#filter-clear-button") from $("#tblstudents").Can anyone help me?

Upvotes: 0

Views: 176

Answers (1)

meo
meo

Reputation: 31249

you should check this link: http://docs.jquery.com/Plugins/Authoring

or here you can find a step by step tutorial: http://www.queness.com/post/112/a-really-simple-jquery-plugin-tutorial it explains how you can define your own options for your plugins.

Upvotes: 3

Related Questions