tags:

views:

106

answers:

5

i have a $.ajax function that POSTS a data.

i have success: function(){alert("successflly posted")}

i check Firebug console, ajax request is POSTED and completed successfully, hOWEVER, the alert message never fires.

+1  A: 

There's probably some error. Try setting the error callback:

error: function(httpRequest, textStatus, errorThrown) { 
   alert("status=" + textStatus + ",error=" + errorThrown);
}

That may tell you why it's not working

Philippe Leybaert
A: 

A great suggestion by Philippe.

You could also try setting breakpoints/watches in firebug to see where your code is actually going (or not going).

Gabriel Hurley
A: 

You can also try the $.post() method, which is a wrapper for the more complicated $.ajax() method.

http://docs.jquery.com/Ajax/jQuery.post

kahoon
A: 

Would you mind posting the entire block of code here? A couple of quick notes- if you are using firebug, you don't need to use the alert() method, instead, use console.log()

Brandon Hansen
A: 

hi. I have the same problem here...

Philippe your error handler is good idea, but it does not fire either.

I am using Firefox 3.5.3, Firebug

$.ajax({
            type: 'POST',
            url: "ajax/AjaxPublic.ashx",
            data: "action=login&lemail=" + lemail + "&lpass=" + lpass,
            success: function(RESULT) { // some alert here }
            error: function(httpRequest, textStatus, errorThrown) { 
               alert("status=" + textStatus + ",error=" + errorThrown);
            }

I think it is something simple, but still any ideas would be appreciated.

Thanks

Aykut