Convert ajax script from 1.8.3 jquery to 1.9 -


i'm trying use pagination script. use jquery ver. 1.9.1 on website, , script works version 1.8.3... i'm new jquery, , don't know how fix it. think, there syntax problem ajax , parseint...

jsfiddle example

original script

jquery

  $(document).ready(function(){           function loading_show(){               $('#loading').html("<img src='images/loading.gif'/>").fadein('fast');           }           function loading_hide(){               $('#loading').fadeout('fast');           }                           function loaddata(page){               loading_show();                                   $.ajax               ({                   type: "post",                   url: "load_data.php",                   data: "page="+page,                   success: function(msg)                   {                       $("#container").ajaxcomplete(function(event, request, settings)                       {                           loading_hide();                           $("#container").html(msg);                       });                   }               });           }           loaddata(1);  // first time page load default results           $('#container .pagination li.active').live('click',function(){               var page = $(this).attr('p');               loaddata(page);            });                      $('#go_btn').live('click',function(){               var page = parseint($('.goto').val());               var no_of_pages = parseint($('.total').attr('a'));               if(page != 0 && page <= no_of_pages){                   loaddata(page);               }else{                   alert('enter page between 1 , '+no_of_pages);                   $('.goto').val("").focus();                   return false;               }            });       }); 

you don't need fix anything, can still use 1.8.3 code new version using jquery migrate plugin. in fiddle on left hand side, have option include migrate plugin.

using plugin easy; include after script tag jquery, example.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script> 

for more information, see jquery migrate documentation.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -