0

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?

1

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

+1, but I'd include this tutorial as well ;) learningjquery.com/2007/10/a-plugin-development-pattern

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.