Support

Home Forums Event Espresso Premium jQuery .live() Causing Errors

jQuery .live() Causing Errors

Posted: February 4, 2013 at 10:28 am


Jeremy Walla

February 4, 2013 at 10:28 am

There are several places in the javascript where the .live() function is still being used. That’s not a problem as long as the version of jQuery is obsolete as well, but, if you are using version 1.9 or above, .live() is now unsupported (it has been a deprecated feature since 1.7). This is not a huge change. Most of the places you are using .live() can be replaced with .on(), and they will still work. The only places where you will need to update your targets is where you are using .live(‘change’).

I bring this up only because it breaks all JS on my site every time I update the EE plugins, and it is a small change.

In EE 3.1.30.2, the ‘Add to Cart’ link/button is not working. It changes to the ajax-loader.gif image, but never updates beyond that. In previous versions, this worked fine ( even after replacing .live() with .on() ).


Jeremy Walla

February 4, 2013 at 11:28 am

Some further detail, it looks like the error is in the ‘event_espresso_do_ajax’ function. If I uncomment the alert there in ‘espresso_cart_functions.js’, I receive the alert message in the browser.

I’m guessing that it doesn’t like the JSON response there, but I’m just frantically debugging.


Seth Shoultes

  • Support Staff

February 4, 2013 at 11:41 am

We have changed the .live() to .on() in version 3.1.30. Do you have a plugin or theme that is loading jQuery 1.8?


Jeremy Walla

February 4, 2013 at 11:51 am

No. It’s only loading 1.9. I wonder if the plugin update through WordPress’ dashboard could be out of date. I updated the plugin this morning, and the js had all of the .live() instances there in the ‘pagination.js’ and ‘espresso_cart_functions.js’ files.

Maybe there is something in one of the other plugins that is interfering with the AJAX functions though. I will try deactivating other plugins to see.


Jeremy Walla

February 4, 2013 at 12:02 pm

I update the AJAX function in ” to the below, and it is working now. It should have worked before because this is just a syntax update. No other changes in plugin usage.

function event_espresso_do_ajax(data, callback){
jQuery.ajax({
    data: data,
    dataType: 'json'
    })
    .done(function(response, textStatus){
        process_response(response, callback);
    })
    .fail(function(resp) {
        //alert('Error.');
    })
    .complete(function(resp){
        //alert('Complete.');
});

}


Seth Shoultes

  • Support Staff

February 4, 2013 at 12:16 pm

Thanks. I’ll take a look.

The support post ‘jQuery .live() Causing Errors’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso