fyneworks / star-rating

jQuery Star Rating Plugin
MIT License
29 stars 17 forks source link

After ajax reload, the stars are missing #6

Closed davidxchen closed 10 years ago

davidxchen commented 10 years ago

Hi, I found a problem that the rating stars are missing when we try to reload a page by using Ajax. How can we fix this?

digggggggggg commented 10 years ago

"Reload the page using ajax"? Sounds like you're updating the DOM and your script only runs on initial page load.

After you've updated the DOM, run your $(.....).rating(); code again.

There used to be plugins that handled this automatically for you, have a look here: http://stackoverflow.com/questions/10770359/jquery-livequery-plug-equivalent-in-jquery-1-7

davidxchen commented 10 years ago

Actually, I use it in jquery datatables' master-detail features, in the detail table. Open the detail table first time, the stars are there. Then I close the detail table and open it again, the stars are gone. I think it should be also mean as you said the DOM is updated.