javascript - Fire jquery event from Java -


i have few elements generated dynamically jquery click event on each element defined follows:

$(".addtocart").live("click", function(e) {  <!-- function body goes here --> }); 

now need implement button adds elements if used clicked on each 1 of them. have implemented logic in servlet after click "add all" button need refresh page ui refreshed. wonder if can fire jquery event servlet in order update gui.

you need update ui within javascript. java , jquery separate beasts , cannot call functions between them. e.g. java cannot call javascript, javascript cannot call java.

instead should add jquery function "add all" similar 1 have shown:

$(".addall").live("click", function(e) {      <!-- send ajax request tell server user has added items cart -->l     <!-- if there no errors, update ui reflect add button being pressed --> }); 

if need function update server side, function need make ajax call tell server has been added cart. see http://api.jquery.com/jquery.ajax/


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -