0

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.

Andreas Grech
  • 105,982
  • 98
  • 297
  • 360
  • Can you post the entire `$.ajax` call? Are you getting any Javascript errors in the error console? – strager Sep 10 '09 at 21:46

4 Answers4

4

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
  • 168,566
  • 31
  • 210
  • 223
0

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
  • 39,690
  • 13
  • 62
  • 88
0

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

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

Attila Kun
  • 2,215
  • 2
  • 23
  • 33
0

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
  • 816
  • 1
  • 10
  • 17