Sunday, January 1, 2012

9:05 AM

I was working with CakePHP's Easy AJAX Pagination Using JQuery. I found this as a great code for sorting and paging with jQuery inCakePHP. But i faced a problem in Mozilla Firefox. It is not working in Mozilla Firefox. While in IE and Crome it works fine for me.


For Mozilla Firefox when i debug it, it shows an error like "501 Method Not Implemented". I searched for this error and Google gives the solution likeClearing Cache and Cookie. But neither works for me. Finally i got the issue and the problem is in jQuery load function.



/** 
 * Loads in a URL into a specified divName, and applies the function to
 * all the links inside the pagination div of that page (to preserve the ajax-request) 
 * @param string href The URL of the page to load 
 * @param string divName The name of the DOM-element to load the data into 
 * @return boolean False To prevent the links from doing anything on their own.
 */ 
function loadPiece(href,divName) {     
    $(divName).load(href, {}, function(){ 
        var divPaginationLinks = divName+" #pagination a";
        $(divPaginationLinks).click(function() {      
            var thisHref = $(this).attr("href"); 
            loadPiece(thisHref,divName); 
            return false; 
        }); 
    }); 

If you open the above link and look at jQuery load function. They have passed the second parameter as {} for data. So that was the problem in Mozilla Firefox. You can remove the {} from jQuery load function. If you find any problem in this than let me know by comment.

0 comments: