Jquery – Why isn’t the serverside callback occuring when I use ‘jQuery ajax’ in seaside 2.9


I'm trying to do something like this in seaside 2.9

html button 
 onClick: (html jQuery ajax
  serialize: (html jQuery this);
  script: [:s | s << (s jQuery id: stratId) append: [html text: 'bing'. html break]]);
 callback: [2 inspect];
with: 'add option'.

and as I expect my div with stratId is getting appended but I'm not getting an inspect window in my squeak image? What's the right way to do this?

Best Solution

The answer is in the second part of the method comment of JQueryInstance>>#serializeThis:

"Serialize the receiving element. Note that this might not work for all form elements: (1) for check-boxes and multi-select lists Seaside internally depends on an additional hidden form element that is generated automatically, instead use #serializeThisWithHidden (2) submit-button callbacks are ignored, instead use a normal callback to trigger specific code evaluation."

Instead put your callback code into the jQuery callback itself, aka the #script: block.

Related Question