Welcome Guest, Not a member yet? Register   Sign In
Jquery ajax request works in some pages and in others it doesnt
#3

[eluser]iceuser[/eluser]
[quote author="vitoco" date="1340913665"]i can see 2 posible problems :
1.- click doesn't get called, cause "el.view_comments" are created dinamically
Solution : use bind() or live()
2.- json response fails, and error event isn't defined
Solution : add "error: function()" to ajax call and check server side

Code:
$(".view_comments").live( 'click' , function()
    {
        alert('CLICKED');
        var cct = $.cookie('csrf_cookie_name');

        $.ajax({
            type: "POST",
            url: www+"comment/getComments",
            dataType: 'json',
            data: {
                csrf_token_name : cct
            },
            error : function( data )
            {
                alert( "ERROR" );
            },
            success: function(data)
            {
                alert( "SUCCESS" );
                $(".page").html(data.html);
            }
        });

    });

Saludos[/quote]

I am already using .live method so this doesnt seem to be the problem here...

what happens is that i get the

CLICKED

message

then the ajax request goes for 5-8 minutes and while i check it via Firebug i can see that the loading gif just spings for all the time without getting any error

then finally after 5-8 minutes i see the red color with an "X" image next to the link and as response i get nothing

i then get the

ERROR

message...

The above request works on Safari(i am on an iMac) and on all browsers on Windows and other machines... it seems my iMac is the problem here... i even removed XAMPP as my web server and added MAMP which didnt fix the problem...

next option is to clean install MAC OS X


Messages In This Thread
Jquery ajax request works in some pages and in others it doesnt - by El Forum - 06-28-2012, 01:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB