Jump to content

ajax requesting multiple times


craygo

Recommended Posts

I have a pretty simple list which comes from a table. I initially show only a couple fields in the list but have an icon which when clicked will load a div with all the details for that row. it works fine but for some reason everytime I click the link it requests the page exponentialy.

 

here is the link

<a href="/media/pdet/'.$r->PID.'" class="load" /><img src="/assets/media/img/info.png" alt="edit" title="Details" border="0" /></a>

here is the jquery function

    $(function(){
        $("a.load").click(function (e) {
            e.preventDefault();
            $("#pdetails").show("slow");
            $("#projd").load($(this).attr("href"));
        });
    });

#pdetails is the main div and #projd is the div the page gets loaded into.

 

And here is the web console from firefox showing what happens

[08:44:55.653] GET http://192.168.20.13/media/pdet/10 [HTTP/1.1 200 OK 63ms]
[08:44:59.672] GET http://192.168.20.13/media/pdet/13 [HTTP/1.1 200 OK 62ms]
[08:44:59.751] GET http://192.168.20.13/media/pdet/13 [HTTP/1.1 200 OK 62ms]
[08:45:02.472] GET http://192.168.20.13/media/pdet/11 [HTTP/1.1 200 OK 62ms]
[08:45:02.555] GET http://192.168.20.13/media/pdet/11 [HTTP/1.1 200 OK 62ms]
[08:45:02.625] GET http://192.168.20.13/media/pdet/11 [HTTP/1.1 200 OK 61ms]
[08:45:02.699] GET http://192.168.20.13/media/pdet/11 [HTTP/1.1 200 OK 62ms]
[08:45:05.677] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 65ms]
[08:45:05.754] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 63ms]
[08:45:05.825] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 63ms]
[08:45:05.892] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 62ms]
[08:45:05.967] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 62ms]
[08:45:06.037] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 62ms]
[08:45:06.106] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 61ms]
[08:45:06.182] GET http://192.168.20.13/media/pdet/12 [HTTP/1.1 200 OK 62ms]

as you can see when I click on a link the first time it request once, then click another it request twice, the third time it runs four times and so on.

If I refresh the page it resets.

 

Thanks in advance for your help.

Ray

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.