Skip to content Skip to sidebar Skip to footer

Javascript Not Working When I Change To Google Jquery Libraries?

Previously I am using JQuery library from here http://jquery.com/download/ http://code.jquery.com/jquery-migrate-1.2.1.min.js I try to include the following code, it work perfectl

Solution 1:

Are you developing locally? Or remotely?

If you are local....you usually have to attach http:// to the google apis

<scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

If not then just....

<scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

Should work...

This should also be replaced...from .live() to .on() as .live() is now deprecated

 $('body').on('click','#go_btn', function(){
                var page = parseInt($('.goto').val());
                var no_of_pages = parseInt($('.total').attr('a'));
                if(page != 0 && page <= no_of_pages){
                    loadData(page);
                }else{

EDIT / UPDATE

You posted this...

<scriptsrc="jquery-1.9.1.js"></script><scriptsrc="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script><scripttype="text/javascript"src="ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

Change to this...

<scripttype="text/javascript"src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><scriptsrc="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

The jquery needs to be above the jquery-ui, as the ui has a dependancy on Jquery, and you can remove v1.9 no sense in loading jquery twice

EDIT 3

I would change this...you don't need that ajaxComplete call, since the success function is doing that anyway...

                $.ajax
                ({
                    type: "POST",
                    url: "listcontact.php",
                    data: {page: page},
                    success: function(msg)
                    {
                            loading_hide();
                            $("#con").html(msg);

                    }
                });

And you made sure to change both your live()'s???

You had two, the other one should look like this...

$('body').on('click','#con .pagination li.active'function(){
                var page = $(this).attr('p');
                loadData(page);
            });        

Solution 2:

try to include the same version JQuery from google :

Number of version JQuery from google should be equal number of version JQuery from Jquery website

but if you want to use recent version, there are some changes , and you should modify something in your code, see log console for more info about problem and check documentation of JQuery here

Solution 3:

Looks like live might not work with the latest version

Replace

.live('click'

with

.on('click'

If there are any dynamically added elements on the page replace your events with this syntax

$(staticContainer).on('click', 'selector'function(){

Where staticContainer is the closest static ancestor of the element.

selector is the element to which you want to attach the event.

Solution 4:

I had experience with similar issue, it may deal with deprecated functions! check EACH piece of function, so that deprecated methods are corrected :) Hope this help you go to somewhere right :) deprecated-ajax-or-jquery-command-cause-no-result-returned Enjoy!

Post a Comment for "Javascript Not Working When I Change To Google Jquery Libraries?"