Hello all,

I think I not using getScript properly and would appreciate very much
if you could help.

I have a page which is load via ajax GET and I need the script to run
again each time new data is loaded (when the user clicks a button).
Something like this (this file is called scripts.js)

$(".button").click(function () {
        var job = $(this).attr("id");
        $.ajax({
          type: "GET",
          url: "results.asp",
          data: "job="+job,
          success: function(html){
                  $("div#load").empty().append(html);
                  $.getScript("scripts.js");
          }
        });
});

As you can see I run the script and in the end I reload the same
script again via getScript so this script (there are other things in
the script) can be applied to the content that has been load as result
of this ajax call.

The problem is that as I click the button the are being doubled....
for example, in the first time it makes ONE request to results.asp and
loads scripts.js ONE time. When I click the button again it requests
TWO times, then FOUR times, then EIGHT times, etc...

What am I doing wrong and how can I run the script on the part of the
site which has been loaded by ajax?

Reply via email to