使用AJAX刷新页面时运行onLoad脚本

I have a piece of jQuery for making items draggable:

$( ".draggable" ).draggable();});

Works fine here, you can drag the words around

It works by running the script which adds some classnames to any span with class="draggable" and it does this on page load, so they look like this:

<span class="draggable ui-draggable" style="position: relative; left: -129.625px; top: -137.625px;">confident</span> 

This issue is that pressing the green button refreshes the wordbank with AJAX, it calls in a new file, wordbank.php and every time you press it'll generate a fresh pool of words for you.

But because of that, once you've refreshed the AJAX it doesn't run the script again so the dragging doesn't work.

How can I get the script to rerun with AJAX?

查看全部
dongyao2129
dongyao2129
2014/03/12 19:07
  • php
  • html
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复