Skip to main content
added 124 characters in body
Source Link
Mołot
  • 21.9k
  • 8
  • 59
  • 112

Form API #ajax effectively disables behaviors on elements. I can't see this documented, but that's how it works, consistently. So the solution was to change the line:

$('#edit-categories-update', context).on('click', function(){

and make it

$('#edit-categories-update').ajaxSuccess(function() {

That way code was not executed on click, but after processing of AJAX triggered by the button succeeded. It's not useful if you want to perform JavaScript before AJAX call, but if you need it to happen after, or if you don't care, it is a sufficient solution. If you need things to happen before AJAX call, use this instead:

$('#edit-categories-update').ajaxStart(function() {

Form API #ajax effectively disables behaviors on elements. I can't see this documented, but that's how it works, consistently. So the solution was to change the line:

$('#edit-categories-update', context).on('click', function(){

and make it

$('#edit-categories-update').ajaxSuccess(function() {

That way code was not executed on click, but after processing of AJAX triggered by the button succeeded. It's not useful if you want to perform JavaScript before AJAX call, but if you need it to happen after, or if you don't care, it is a sufficient solution.

Form API #ajax effectively disables behaviors on elements. I can't see this documented, but that's how it works, consistently. So the solution was to change the line:

$('#edit-categories-update', context).on('click', function(){

and make it

$('#edit-categories-update').ajaxSuccess(function() {

That way code was not executed on click, but after processing of AJAX triggered by the button succeeded. It's not useful if you want to perform JavaScript before AJAX call, but if you need it to happen after, or if you don't care, it is a sufficient solution. If you need things to happen before AJAX call, use this instead:

$('#edit-categories-update').ajaxStart(function() {
Source Link
Mołot
  • 21.9k
  • 8
  • 59
  • 112

Form API #ajax effectively disables behaviors on elements. I can't see this documented, but that's how it works, consistently. So the solution was to change the line:

$('#edit-categories-update', context).on('click', function(){

and make it

$('#edit-categories-update').ajaxSuccess(function() {

That way code was not executed on click, but after processing of AJAX triggered by the button succeeded. It's not useful if you want to perform JavaScript before AJAX call, but if you need it to happen after, or if you don't care, it is a sufficient solution.