I'm trying to use a plugin for paging from jquery, the thing is that the demo is not very clear, at least for me that I'm not very familiar with jquery and httphandlers. Here is the javascript code.

$(function () {    
    var a  = 10;
    var b = 10;
    
    function get_data(l, li) {

        $.ajax({
            type: "POST",
            url: "Handler.ashx",
            data: { type: "get" },
            sucess: function (html) {
                $("#results").html(html);
            }
        });
    }
    get_data(1, b);

    $.ajax({
        type: "POST",
        url: "Handler.ashx",
        data: { type: "total" },
        success: function (total) {
            $("paging").jpaging({
                all_items_num: total,
                callback: get_data,
                items_on_page: a,
                pages_step: b
            });
        }
    });
});

Then in my handler I'm trying to do this, this is beacause I'm following a tutorial to use a Jquery Plugin for paging, the web page for this plugin is http://jpaging.fahon.org/usage

In the handler it puts this code in the http context function

the "context" is the HttpContext variable.

context.Request.Form["type"]

I thought it was getting the variable "type" from the data in the ajax in the javascript but it does not get me anything, it always gets null.

What am I doing wrong?

Thanks in Advance

Member Avatar for stbuchok

Would using a web service instead of an HTTPHandler make it easier? If so, I'd say use a web service.

I'm not sure I understand exactly what you are asking, but a good start is to fix the typos. Success is spelled wrong on line 11 and it looks like you are missing a # on line 23 in your selector.

I also notice that you aren't passing in the start and end pages on line 10, but I'm not sure that matters.

Once those mistakes are fixed, check to see if it is still not working and maybe post a description of exactly what you are trying to achieve.

Hi, thanks for your help, I will try to fix the syntax, I think that might be the problem.

I thought that it might be something with trying to run 2 ajax functions at the same time, but let me try your suggestions and see what happens,

I'm doing paging for a database query and show the result without loading the whole page just so you know what I'm trying to archive.

Thanks

Finally I got it working, I have several issues with my javascript and http handler class.

THanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.