DEBASISH
DEBASISH

Reputation: 19

Javascript alert is not called in callback

I am facing one problem in my javascript code.I am calling one url that is returning one partialview and loading it in a div.After that i have tablesorter method for pagination.But after loading that url paging is not working properly. My code is below:

CODE SECTION:

function FileMastergridpage(text) {
    var url = encodeURI("Setpagesize_allrulesgrid?pagesize=" + text + "");
    jQuery("#ruledetailsgrid").load(url, paging_function() );
}

function paging_function (){
    alert('hello');
    jQuery("#StandardGridid").tablesorter();
    jQuery("#StandardGridid").tablesorterPager({ container: jQuery("#pagerOne"), positionFixed: false });
} 

I am not able to get the 'hello' alert also.So any help will be highly appreciated..

Upvotes: 1

Views: 88

Answers (2)

zafus_coder
zafus_coder

Reputation: 4591

Your code will either be like this :

function FileMastergridpage(text) {
var url = encodeURI("Setpagesize_allrulesgrid?pagesize=" + text + "");
jQuery("#ruledetailsgrid").load(url,function() {

alert('hello');
jQuery("#StandardGridid").tablesorter();
jQuery("#StandardGridid").tablesorterPager({ container: jQuery("#pagerOne"),     positionFixed: false });
 });

or :

 function FileMastergridpage(text) {
var url = encodeURI("Setpagesize_allrulesgrid?pagesize=" + text + "");
jQuery("#ruledetailsgrid").load(url, paging_function );
 }

function paging_function (){
alert('hello');
jQuery("#StandardGridid").tablesorter();
jQuery("#StandardGridid").tablesorterPager({ container: jQuery("#pagerOne"), positionFixed: false });
} 

Upvotes: 0

Barmar
Barmar

Reputation: 782466

It should be:

jQuery("#ruledetailsgrid").load(url, paging_function);

You're calling the function immediately, not passing it as a callback.

Upvotes: 4

Related Questions